Date: Sun, 19 Nov 2023 10:30:25 -0600 From: Mike Karels <mike@karels.net> To: =?utf-8?q?Mina_Gali=C4=87?= <freebsd@igalic.co> Cc: Kyle Evans <kevans@FreeBSD.org>, freebsd-net@freebsd.org Subject: Re: How to tell if a network interface was renamed (and from what) Message-ID: <99D24919-A5DF-4A8B-882F-9D724AAD494F@karels.net> In-Reply-To: <ptnVEMJ_x48tdYePN4iYRiEW2vWqwulbEOUJ4dQ1cKGkxNXZPPfdEVHdJKNHFfs2onxNipVZKPwDZZKlDv1peS1Xttim1VitMFsdUiTkAKE=@igalic.co> References: <pdHC0ObBkAbx2HfFIhWYaB5-dmQDEUzNTWvVVJAuJV7FWdWWeSwybVFD-uyBUxPlqDRpAW7D1aAZsbrTxEj9kqsq7ESgO41srPmS-PcXGqw=@igalic.co> <E5F5F61E-3827-404A-A46F-BBCF45A29A82@FreeBSD.org> <9eef5488-e8da-4edd-bc00-baeb5aaf4a23@FreeBSD.org> <ptnVEMJ_x48tdYePN4iYRiEW2vWqwulbEOUJ4dQ1cKGkxNXZPPfdEVHdJKNHFfs2onxNipVZKPwDZZKlDv1peS1Xttim1VitMFsdUiTkAKE=@igalic.co>
next in thread | previous in thread | raw e-mail | index | archive | help
On 19 Nov 2023, at 8:34, Mina Gali=C4=87 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 ha= s >> 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 interf= ace has been renamed is if we need to know what driver we're working with= =2E > > But given that a rename doesn't change =E2=80=94 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 device= s 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99D24919-A5DF-4A8B-882F-9D724AAD494F>