Re: How to tell if a network interface was renamed (and from what)
Date: Sun, 19 Nov 2023 17:49:33 UTC
> On Nov 19, 2023, at 10:34 PM, Mina Galić <freebsd@igalic.co> wrote: > > > >>> FreeBSD currently does not preserve the old ( original ) name of >>> interfaces if it is renamed ( either physical or cloned ones ). >>> While there's an attempt https://reviews.freebsd.org/D28247 >>> to get the device name (physical >>> ones) but it is not perfect and not completed. >>> >>> So may I ask why you need to know if a network interface was renamed ? >> >> >> Just last week I found this quite a pain as well; once an interface has >> been renamed, if it's not a pseudo-interface with an obvious group >> there's no clear way, AFAICT, to determine which driver created it > > I think the main reason that we need to know if and from what an interface has been renamed is if we need to know what driver we're working with. > > But given that a rename doesn't change — or even just *alias* > the sysctl dev hierarchy, where a %driver is recorded, we can't > track it back. > > (but again, that's just for physical devices, then again virtual devices record what type of device they are in their group which > is essentially the same thing) Since it is just for physical devices, may I propose to have the driver name in their groups ? So an if_ure interface ue0 will look like: ``` ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 options=60009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,RXCSUM_IPV6,TXCSUM_IPV6> ether 00:e0:4c:xx:xx:xx media: Ethernet autoselect (1000baseT <full-duplex>) status: active +++ groups: ure nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> ``` That does not include the unit number. But could be useful to quickly get the driver name of physical devices. > > As soon as we have more than one interface with different drivers > it's impossible to parse out what we're dealing with without > parsing rc.conf, logs, or worse things I can't think of right now. > > > > >