Date: Mon, 20 Nov 2023 11:10:20 +0800 From: Zhenlei Huang <zlei@FreeBSD.org> To: =?utf-8?Q?Mina_Gali=C4=87?= <freebsd@igalic.co> Cc: Kyle Evans <kevans@FreeBSD.org>, freebsd-net@freebsd.org, "mike@karels.net" <mike@karels.net> Subject: Re: How to tell if a network interface was renamed (and from what) Message-ID: <1A3E6AF3-400B-4807-8C9F-EBA438B41703@FreeBSD.org> In-Reply-To: <rvRLOlpJc9xIf67ZwmZ4Si6TN2VtmIuyuguoQgEk5NTOeqsqkAwB_9KvlMbW6y-npSjCC2lmLVXbD4oIqyKJdDboThcWiehF_hU0L9D6GZc=@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> <032BADD4-0A49-42E2-BAAB-40D2F76C64B9@FreeBSD.org> <rvRLOlpJc9xIf67ZwmZ4Si6TN2VtmIuyuguoQgEk5NTOeqsqkAwB_9KvlMbW6y-npSjCC2lmLVXbD4oIqyKJdDboThcWiehF_hU0L9D6GZc=@igalic.co>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] > 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 [-- Attachment #2 --] <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Nov 20, 2023, at 5:35 AM, Mina Galić <<a href="mailto:freebsd@igalic.co" class="">freebsd@igalic.co</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Zhenlei,<br class=""><br class=""><br class=""><blockquote type="cite" class="">Since it is just for physical devices, may I propose to have the driver name in their groups ?<br class=""><br class="">So an if_ure interface ue0 will look like:<br class=""><br class="">```<br class="">ue0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500<br class=""><br class="">options=60009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,RXCSUM_IPV6,TXCSUM_IPV6><br class=""><br class="">ether 00:e0:4c:xx:xx:xx<br class="">media: Ethernet autoselect (1000baseT <full-duplex>)<br class=""><br class="">status: active<br class="">+++ groups: ure<br class="">nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL><br class=""><br class="">```<br class=""><br class="">That does not include the unit number. But could be useful to quickly get the driver name of physical devices.<br class=""><br class=""></blockquote><br class="">Given that currently on FreeBSD the easiest way to tell if something<br class="">is a physical device is by checking the *absence* of groups,</div></div></blockquote><div><br class=""></div><div>Emm, that sounds more a HACK to test physical devices.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""> this<br class="">would only really be acceptable if we add an "egress" group like<br class="">OpenBSD does, in addition to the driver name.<br class=""><br class="">If we can't do that, then I think Mike's solution with having the<br class="">driver (and unit) as a separate category would be preferable.<br class=""></div></div></blockquote><div><br class=""></div><div>The interface group feature was imported from OpenBSD by 0dad3f0e1512 .</div><div><br class=""></div><div>> Import interface groups from OpenBSD. This allows to group interfaces in</div><div>> order to - for example - apply firewall rules to a whole group of</div><div>> interfaces. This is required for importing pf from OpenBSD 3.9</div><div><br class=""></div><div>Despite the purpose to get <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">driver name, it </span>seems not useful to have driver name in groups.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Unrelatedly, I don't see anything in ure(4) mentioning that if_ure<br class="">devices will be named "ue".<br class=""></div></div></blockquote><div><br class=""></div><div>Currently usb ethernet have <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">interface named `</span>ue%u` regardless the actual device drivers.</div><div>See <a href="https://cgit.freebsd.org/src/tree/sys/dev/usb/net/usb_ethernet.c#n202" class="">https://cgit.freebsd.org/src/tree/sys/dev/usb/net/usb_ethernet.c#n202</a></div><div>```</div><div><div>static void</div><div>ue_attach_post_task(struct usb_proc_msg *_task)</div><div>{</div><div>...</div><div> if_initname(ifp, "ue", ue->ue_unit);</div><div>...</div><div>}</div></div><div>```</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">Don't we usually document such deviation from the norm?<br class=""></div></div></blockquote><div><br class=""></div><div>I'm not familiar with usb protocols, I guess usb <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">ethernet is sub device of usb controller.</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><br class=""></span></div><div>```</div><div><div>smsc0 on uhub1</div><div>smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus1</div><div>ue0: <USB Ethernet> on smsc0</div></div><div>```</div><div><br class=""></div><div>Then `ue%u` for all usb ethernet make senses.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><br class="">Kind regards,<br class=""><br class="">Mina<br class=""></div></div></blockquote></div><br class=""><div class=""> <div><br class=""></div> </div> <br class=""></body></html>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1A3E6AF3-400B-4807-8C9F-EBA438B41703>
