[Bug 273315] ifconfig -g does not show epair from removed jail

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 23 Aug 2023 20:04:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273315

            Bug ID: 273315
           Summary: ifconfig -g does not show epair from removed jail
           Product: Base System
           Version: 13.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: jcaplan@blackberry.com

Steps to reproduce
------------------

root@freebsd:/usr/home/jcaplan # ifconfig epair create
epair0a
root@freebsd:/usr/home/jcaplan # ifconfig -g epair
epair0b
epair0a
root@freebsd:/usr/home/jcaplan # jail -c name=test vnet vnet.interface=epair0b
persist
root@freebsd:/usr/home/jcaplan # jls -v
   JID  Hostname                      Path
        Name                          State
        CPUSetID
        IP Address(es)
     1                                /
        test                          ACTIVE
        3
root@freebsd:/usr/home/jcaplan # ifconfig -g epair
epair0a
root@freebsd:/usr/home/jcaplan # jail -r test
root@freebsd:/usr/home/jcaplan # ifconfig -g epair
epair0a
root@freebsd:/usr/home/jcaplan # ifconfig epair0b
epair0b: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 02:b4:31:04:84:0b
        inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
        media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Actual Results: 
---------------
ifconfig -g does not show epair0b after jail is removed

Expected Results:
-----------------
ifconfig -g should show epair0b after jail is removed


Build Date & Hardware:
----------------------
root@freebsd:/usr/home/jcaplan # uname -a
FreeBSD freebsd 13.2-RELEASE FreeBSD 13.2-RELEASE
releng/13.2-n254617-525ecfdad597 GENERIC amd64


Additional Information
----------------------
When detaching epair0b to move into the jail, if_vmove() finds an ifc:

rc = if_detach_internal(ifp, 1, &ifc); // ifc != NULL

However, when moving epair0b back in the other direction and detaching from the
jail vnet, ifc == NULL so if_attach_internal() skips
if_clone_addgroup(ifc=epair)

-- 
You are receiving this mail because:
You are the assignee for the bug.