Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2023 16:03:50 -0600
From:      Mike Karels <mike@karels.net>
To:        Kristof Provost <kp@FreeBSD.org>
Cc:        =?utf-8?q?Mina_Gali=C4=87?= <freebsd@igalic.co>, Zhenlei Huang <zlei@FreeBSD.org>, 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:  <CABE55DC-6415-4297-8018-752A57D62343@karels.net>
In-Reply-To: <F2536F44-5C61-4AE3-BEDA-705DD660A8F7@FreeBSD.org>
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> <032BADD4-0A49-42E2-BAAB-40D2F76C64B9@FreeBSD.org> <rvRLOlpJc9xIf67ZwmZ4Si6TN2VtmIuyuguoQgEk5NTOeqsqkAwB_9KvlMbW6y-npSjCC2lmLVXbD4oIqyKJdDboThcWiehF_hU0L9D6GZc=@igalic.co> <31B38FCE-0B67-4122-A202-568150E971E1@karels.net> <F2536F44-5C61-4AE3-BEDA-705DD660A8F7@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 20 Nov 2023, at 14:56, Kristof Provost wrote:

> On 20 Nov 2023, at 21:29, Mike Karels wrote:
>> On 19 Nov 2023, at 15:35, Mina Gali=C4=87 wrote:
>>> Hi Zhenlei,
>>>
>>>
>>>> Since it is just for physical devices, may I propose to have the dri=
ver name in their groups ?
>>>>
>>>> So an if_ure interface ue0 will look like:
>>>>
>>>> ```
>>>> ue0: flags=3D1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP=
> metric 0 mtu 1500
>>>>
>>>> options=3D60009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,R=
XCSUM_IPV6,TXCSUM_IPV6>
>>>>
>>>> ether 00:e0:4c:xx:xx:xx
>>>> media: Ethernet autoselect (1000baseT <full-duplex>)
>>>>
>>>> status: active
>>>> +++ groups: ure
>>>> nd6 options=3D23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
>>>>
>>>> ```
>>>>
>>>> That does not include the unit number. But could be useful to quickl=
y get the driver name of physical devices.
>>>>
>>>
>>> Given that currently on FreeBSD the easiest way to tell if something
>>> is a physical device is by checking the *absence* of groups, this
>>> would only really be acceptable if we add an "egress" group like
>>> OpenBSD does, in addition to the driver name.
>>>
>>> If we can't do that, then I think Mike's solution with having the
>>> driver (and unit) as a separate category would be preferable.
>>
>> I have a proof of concept that makes the presumed original name
>> (driver name + unit number) available to ifconfig, which prints
>> the string with everything else in the standard output format.
>> I don't think that is the right solution,
>
> I believe a similar solution has been proposed before, and it failed to=
 cope with things like epair interfaces.

Hmm, epair certainly breaks the rules (well, conventions).  My current
code sees "epair0" for both halves, which may not be what is desired.
epair does some of this by hand, so could have more custom code.

> I=E2=80=99d look in the direction of just adding a field to struct ifne=
t with the original interface name (likely easily done in if_attach()), a=
long with a new ioctl to retrieve that field.

That may be as good as we can do, although I'm working with netlink
rather than ioctls.

But see the next message...

		Mike

> Best regards,
> Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABE55DC-6415-4297-8018-752A57D62343>