Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2023 01:49:33 +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
Subject:   Re: How to tell if a network interface was renamed (and from what)
Message-ID:  <032BADD4-0A49-42E2-BAAB-40D2F76C64B9@FreeBSD.org>
In-Reply-To: <ptnVEMJ_x48tdYePN4iYRiEW2vWqwulbEOUJ4dQ1cKGkxNXZPPfdEVHdJKNHFfs2onxNipVZKPwDZZKlDv1peS1Xttim1VitMFsdUiTkAKE=@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>

next in thread | previous in thread | raw e-mail | index | archive | help



> On Nov 19, 2023, at 10:34 PM, Mina Galić <freebsd@igalic.co> wrote:
> 
> 
> 
>>> FreeBSD currently does not preserve the old ( original ) name of
>>> interfaces if it is renamed ( either physical or cloned ones ).
>>> While there's an attempt https://reviews.freebsd.org/D28247
>>> to get the device name (physical
>>> ones) but it is not perfect and not completed.
>>> 
>>> So may I ask why you need to know if a network interface was renamed ?
>> 
>> 
>> Just last week I found this quite a pain as well; once an interface has
>> been renamed, if it's not a pseudo-interface with an obvious group
>> there's no clear way, AFAICT, to determine which driver created it
> 
> I think the main reason that we need to know if and from what an interface has been renamed is if we need to know what driver we're working with.
> 
> But given that a rename doesn't change — or even just *alias*
> the sysctl dev hierarchy, where a %driver is recorded, we can't
> track it back.
> 
> (but again, that's just for physical devices, then again virtual devices record what type of device they are in their group which
> is essentially the same thing)

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.

> 
> As soon as we have more than one interface with different drivers
> it's impossible to parse out what we're dealing with without
> parsing rc.conf, logs, or worse things I can't think of right now.
> 
> 
> 
> 
> 






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?032BADD4-0A49-42E2-BAAB-40D2F76C64B9>