Re: How to tell if a network interface was renamed (and from what)

From: Mike Karels <mike_at_karels.net>
Date: Mon, 20 Nov 2023 22:06:53 UTC
On 20 Nov 2023, at 15:16, Franco Fichtner wrote:

>> On 20. Nov 2023, at 21:56, Kristof Provost <kp@FreeBSD.org> wrote:
>>
>> I’d look in the direction of just adding a field to struct ifnet with the original interface name (likely easily done in if_attach()), along with a new ioctl to retrieve that field.
>
> ifconfig_get_orig_name() already exists, but apart from wlandebug
> nothing is using it.

Thanks for pointing that out!  I hadn't noticed it.  I also hadn't thought
of that way to fetch the driver name and unit.

> The internally used IFDATA_DRIVERNAME also appears in ifinfo
> (not installed in base) and bsnmpd but that's it.
>
> if_dname is the target and it exists in ifnet struct along with
> a man page entry in inet(9).
>
> All that is really missing is a way to print it via ifconfig command.

That is trivial to add; I just tested it.  It also has problems with
epair.  Maybe that isn't an issue for this purpose.  I hate to invent
something new when there is something already existing that solves
most of the problem.

		Mike

> Cheers,
> Franco