On 19 Nov 2023, at 8:34, Mina Galić 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) > > 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.
The kernel has a driver name for each interface, which looks like it doesn't change currently in most cases. There is a kernel accessor function, but I don't think it is exported to user space now. It could be, though. Would this be sufficient for your purposes? There is also a unit number, which could also be exported. Mike