From nobody Mon Nov 20 03:10:20 2023 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SYXZC6qqQz51mn4 for ; Mon, 20 Nov 2023 03:10:27 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SYXZC65xYz4MMG; Mon, 20 Nov 2023 03:10:27 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700449827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ye1d0W3V8q/Vc0mkk6RYKshTJb2fGn1ZF6CqDAdYORg=; b=K6Kvme89KMxuxQk6RRYpX7d9obo2FNH3o0aJ/2gvaBS0joe/UyKqVkezkyQQKgX9SmT1Mh qeUZyGJ2xBRJkhfi1uYiOpGY0Zta5B8u49OKqW0pisVay3B6avPoaGUsAAO4TpN7voWsBT QHyeUrrHpU9s6sDhjya/vBzR6zdqsWIHRLTAl2CTYaSFOjuWcAaElckvzsrU3UVNZb0Mxm lLZ0gsv76B3qwyvXyMYsvxX5+GCeb8PZC9HlVZg6va0Jn1hw1NPX/TRiRU5thfSgd3VaIw chI1VqCWTxobt+1GLfaTt2VLKL0u2UhCFPABp3+RejYJq42s0dYtnhUwkYInZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700449827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ye1d0W3V8q/Vc0mkk6RYKshTJb2fGn1ZF6CqDAdYORg=; b=NuCdbTyWQiR07mC0vjVlsqFN3ZABTy4b1c9a0ZmGJ1KP+4Bf2yMt4SN+UKyCXIhvO45dCW d0EXmSrSRYY1B4B1+0c5mHK3u6mPfYxXlIy09Vc40DTs9res9xM7BRwY069AIJEAy0bXDh jDC1Qy8oY/6ADRqPurH5beRsfzJM5YZ4AOf96zCmdohXHdFfwtGxlHN8HCqPeXcLGLiZmU Wv2/dINKlqvxKCaq15XbLAcSMtD72GvJWsmH7shQekq/T1qde1XH/3MHuBphLh4ctB3evm NecjiPTsjvIjoR6swfgBodWxyJ+wJCOYbKQroAMTJy1T/cLuCzZQ/GTF/JtHbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700449827; a=rsa-sha256; cv=none; b=cyz+W4ljkdXdPSRj2sTVmkpLkE1wBlHZC2Xi8alSxCD8lprjgXuQ3EXM64731QUsrpKLBr VCEaNSi3GgzIS3kNy8xeUJoCrk3i6EzjLtGbJX7K9O9DCvGbPyA3fX1hZx8f7DUgVzBI5U aFwbJ2/pwUZti77OTtV17nMMFwieIM+x2l1qJ9d6I1ncIVl37L+9qqN0AF0lKVPbK6BhCF mH/mR0pIOVf0W5veExAbuTB5+fanApsgoX8CFx5e0ZECqN5k7+9JmNHGOUqfOsA09OQujp ckPvwAarYvvfqv89G9f3svEo9/lUg3dWfVyml0SEcZCWhV1bdUrmlmHlXFMp9g== Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4SYXZB1779z8yw; Mon, 20 Nov 2023 03:10:25 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: <1A3E6AF3-400B-4807-8C9F-EBA438B41703@FreeBSD.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_A81168F8-59F9-4063-8D58-CE25C2427A96" List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: How to tell if a network interface was renamed (and from what) Date: Mon, 20 Nov 2023 11:10:20 +0800 In-Reply-To: Cc: Kyle Evans , freebsd-net@freebsd.org, "mike@karels.net" To: =?utf-8?Q?Mina_Gali=C4=87?= References: <9eef5488-e8da-4edd-bc00-baeb5aaf4a23@FreeBSD.org> <032BADD4-0A49-42E2-BAAB-40D2F76C64B9@FreeBSD.org> X-Mailer: Apple Mail (2.3696.120.41.1.4) --Apple-Mail=_A81168F8-59F9-4063-8D58-CE25C2427A96 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 20, 2023, at 5:35 AM, Mina Gali=C4=87 = wrote: >=20 > Hi Zhenlei, >=20 >=20 >> Since it is just for physical devices, may I propose to have the = driver name in their groups ? >>=20 >> So an if_ure interface ue0 will look like: >>=20 >> ``` >> ue0: flags=3D1008843 = metric 0 mtu 1500 >>=20 >> = options=3D60009b >>=20 >> ether 00:e0:4c:xx:xx:xx >> media: Ethernet autoselect (1000baseT ) >>=20 >> status: active >> +++ groups: ure >> nd6 options=3D23 >>=20 >> ``` >>=20 >> That does not include the unit number. But could be useful to quickly = get the driver name of physical devices. >>=20 >=20 > 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. >=20 > 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. >=20 > 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 = ``` 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: on usbus1 ue0: on smsc0 ``` Then `ue%u` for all usb ethernet make senses. >=20 >=20 > Kind regards, >=20 > Mina --Apple-Mail=_A81168F8-59F9-4063-8D58-CE25C2427A96 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Nov 20, 2023, at 5:35 AM, Mina Gali=C4=87 <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=3D1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> = metric 0 mtu 1500

options=3D60009b<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=3D23<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.
```
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



= --Apple-Mail=_A81168F8-59F9-4063-8D58-CE25C2427A96--