lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <665459ff-9e99-4d22-9aeb-69c34be3db6b@tk154.de>
Date: Thu, 5 Dec 2024 17:28:47 +0100
From: Til Kaiser <mail@...54.de>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 gregkh@...uxfoundation.org, idosch@...dia.com, petrm@...dia.com
Subject: Re: [PATCH net-next v2] net: sysfs: also pass network device driver
 to uevent

On 19.11.24 02:55, Jakub Kicinski wrote:
> On Sat, 16 Nov 2024 17:30:30 +0100 Til Kaiser wrote:
>> Currently, for uevent, the interface name and
>> index are passed via shell variables.
>>
>> This commit also passes the network device
>> driver as a shell variable to uevent.
>>
>> One way to retrieve a network interface's driver
>> name is to resolve its sysfs device/driver symlink
>> and then substitute leading directory components.
>>
>> You could implement this yourself (e.g., like udev from
>> systemd does) or with Linux tools by using a combination
>> of readlink and shell substitution or basename.
>>
>> The advantages of passing the driver directly through uevent are:
>>   - Linux distributions don't need to implement additional code
>>     to retrieve the driver when, e.g., interface events happen.
>>   - There is no need to create additional process forks in shell
>>     scripts for readlink or basename.
>>   - If a user wants to check his network interface's driver on the
>>     command line, he can directly read it from the sysfs uevent file.
> 
> Thanks for the info, since you're working on an open source project
> - I assume your exact use case is not secret, could you spell it
> out directly? What device naming are you trying to achieve based on
> what device drivers? In my naive view we have 200+ Ethernet drivers
> so listing Ethernet is not scalable. I'm curious what you're matching,
> how many drivers you need to list, and whether we could instead add a
> more general attribute...
> 
> Those questions aside, I'd like to get an ack from core driver experts
> like GregKH on this. IDK what (if any) rules there are on uevents.
> The merge window has started so we are very unlikely to hear from them
> now, all maintainers will be very busy. Please repost v3 in >=two weeks
> and CC Greg (and whoever else is reviewing driver core and/or uevent
> changes according to git logs).

We have some Mellanox Spectrum Switches here whose network interface 
names don't match their faceplate. They are called eth... and their 
numbering is also out of order, so we would like to rename them 
accordingly. They are using the mlxsw_spectrum driver.

Generally, you could do that once at boot time, but those Spectrum 
Switches also support port splitting. That means you can attach a 
breakout cable to one of its ports and then use the devlink tool to 
split the network interface into multiple ones in Linux. But the split 
network interfaces are then called eth... again:

root@...100:~# ip l | tail -n2
26: swp1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
     link/ether 50:6b:4b:9f:04:59 brd ff:ff:ff:ff:ff:ff
root@...100:~# devlink port split swp1 count 4
root@...100:~# ip l | tail -n8
27: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
     link/ether 50:6b:4b:9f:04:59 brd ff:ff:ff:ff:ff:ff
28: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
     link/ether 50:6b:4b:9f:04:5a brd ff:ff:ff:ff:ff:ff
29: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
     link/ether 50:6b:4b:9f:04:5b brd ff:ff:ff:ff:ff:ff
30: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
     link/ether 50:6b:4b:9f:04:5c brd ff:ff:ff:ff:ff:ff

In their GitHub wiki [1], Mellanox recommends using a udev rule for 
renaming. udev has its implementation for retrieving the driver of a 
network interface, whereas OpenWrt's hotplug doesn't have such an 
implementation. With this patch, the driver name would be already 
available inside such hotplug scripts.

[1] 
https://github.com/Mellanox/mlxsw/wiki/Switch-Port-Configuration#using-udev-rules

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ