Re: How to tell if a network interface was renamed (and from what)
- In reply to: Mina_Galić : "Re: How to tell if a network interface was renamed (and from what)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Nov 2023 03:10:20 UTC
> On Nov 20, 2023, at 5:35 AM, Mina Galić <freebsd@igalic.co> wrote:
>
> Hi Zhenlei,
>
>
>> 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.
>>
>
> Given that currently on FreeBSD the easiest way to tell if something
> is a physical device is by checking the *absence* of groups,
Emm, that sounds more a HACK to test physical devices.
> 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.
The interface group feature was imported from OpenBSD by 0dad3f0e1512 .
> Import interface groups from OpenBSD. This allows to group interfaces in
> order to - for example - apply firewall rules to a whole group of
> interfaces. This is required for importing pf from OpenBSD 3.9
Despite the purpose to get driver name, it seems not useful to have driver name in groups.
>
> Unrelatedly, I don't see anything in ure(4) mentioning that if_ure
> devices will be named "ue".
Currently usb ethernet have interface named `ue%u` regardless the actual device drivers.
See https://cgit.freebsd.org/src/tree/sys/dev/usb/net/usb_ethernet.c#n202 <https://cgit.freebsd.org/src/tree/sys/dev/usb/net/usb_ethernet.c#n202>
```
static void
ue_attach_post_task(struct usb_proc_msg *_task)
{
...
if_initname(ifp, "ue", ue->ue_unit);
...
}
```
> Don't we usually document such deviation from the norm?
I'm not familiar with usb protocols, I guess usb ethernet is sub device of usb controller.
```
smsc0 on uhub1
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus1
ue0: <USB Ethernet> on smsc0
```
Then `ue%u` for all usb ethernet make senses.
>
>
> Kind regards,
>
> Mina