[systemd-devel] Updating network file during boot

Henti Smith henti at gaydonsmith.co.uk
Thu Aug 15 09:16:03 UTC 2024


Hi Silvio,

Thank you for this information. Unfortunately, this does not seem to have
the uniquely identifiable information I can use to consistently match the
devices.  See below.

root at av20-mvc-01:~# lspci -d:"$marvell_device_id"
04:00.0 Ethernet controller: Marvell Technology Group Ltd. Device 0f13 (rev
01)
05:00.0 Ethernet controller: Marvell Technology Group Ltd. Device 0f13 (rev
01)

root at av20-mvc-01:~# udevadm info /sys/class/net/eno2
P: /devices/pci0000:00/0000:00:10.0/0000:04:00.0/net/eno2
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:10.0/0000:04:00.0/net/eno2
E: INTERFACE=eno2
E: IFINDEX=3
E: SUBSYSTEM=net
E: USEC_INITIALIZED=8220209
E: ID_NET_NAMING_SCHEME=v245
E: ID_NET_NAME_MAC=enx02000000000b
E: ID_NET_NAME_ONBOARD=eno2
E: ID_NET_LABEL_ONBOARD=Onboard ETHERNET Controller
E: ID_NET_NAME_PATH=enp4s0
E: ID_BUS=pci
E: ID_VENDOR_ID=0x11ab
E: ID_MODEL_ID=0x0f13
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Marvell Technology Group Ltd.
E: ID_PATH=pci-0000:04:00.0
E: ID_PATH_TAG=pci-0000_04_00_0
E: ID_NET_DRIVER=oak
E: ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/eno2
E: TAGS=:systemd:

root at av20-mvc-01:~# udevadm info /sys/class/net/mvc-sw1
P: /devices/pci0000:00/0000:00:11.0/0000:05:00.0/net/mvc-sw1
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:05:00.0/net/mvc-sw1
E: INTERFACE=mvc-sw1
E: IFINDEX=4
E: SUBSYSTEM=net
E: USEC_INITIALIZED=8376130
E: ID_NET_NAMING_SCHEME=v245
E: ID_NET_NAME_MAC=enx02000000000c
E: ID_NET_NAME_PATH=enp5s0
E: ID_BUS=pci
E: ID_VENDOR_ID=0x11ab
E: ID_MODEL_ID=0x0f13
E: ID_PCI_CLASS_FROM_DATABASE=Network controller
E: ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
E: ID_VENDOR_FROM_DATABASE=Marvell Technology Group Ltd.
E: ID_PATH=pci-0000:05:00.0
E: ID_PATH_TAG=pci-0000_05_00_0
E: ID_NET_DRIVER=oak
E: ID_NET_LINK_FILE=/etc/systemd/network/10-oxb-mvc-sw1.link
E: ID_NET_NAME=mvc-sw1
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/mvc-sw1
/sys/subsystem/net/devices/mvc-sw1
E: TAGS=:systemd:

The PCI bus seems to be the only unique information point, but as I
explained, this changes on power cycle with the hotswop board plugged in
and not.

Looking at the output now I see that the first device is named by default
link file and I might be able to use the OriginalName to match on. I'm
going to try and remove all the networking configuration in
/etc/systemd/network/ and see what device names come up as those might be
more consistent and can be used.

I will test and provide feedback.

Kind regards
Henti

On Tue, 13 Aug 2024 at 18:04, Silvio Knizek <killermoehre at gmx.net> wrote:

> Am Dienstag, dem 13.08.2024 um 17:16 +0100 schrieb Henti Smith:
> > Good day everybody.
> >
> > I've searched high and low and cannot seem to find an answer for what
> I'm trying to do. The most relevant I found was this [1] thread in 2020,
> but only because I'm using a script to change the contents of my .link
> files during boot, which is not working constantly.
> >
> > Some things to note:
> > 1. The hardware is sample hardware so Mac addresses are 00:00:00:00:00.
> > 2. The hardware has an external hot-swap PCId port that takes a board
> for VGA out.
> > 3. We're attempting to configure two interfaces.
> >
> > The problem is when the board is attached the PCI numbering of the two
> interfaces change. With the board attached, it's 5 and 6, without it 4 and
> 5.
> >
> > Normally this would not be a problem, since you can Match on mac
> address, but in this case, both have the same mac address of
> 00:00:00:00:00.
> >
> > My attempt to fix this was to create a script [2] that enumerated the
> PCI ports for the hardware manufacturer and use that information to update
> the link files [2] before systemd-networkd starts, but this does not work
> constantly.
> >
> > Are there any other recommendations to resolve this situation or if my
> approach is the only real way to do this, how can I ensure my script is
> executed before systemd uses the link files to apply the interface
> configuration ?
> >
> > [1]
> https://lists.freedesktop.org/archives/systemd-devel/2020-June/044784.html
> > [2] https://paste.mozilla.org/jgcCyo9A
> > [3] https://paste.mozilla.org/zXQYpXpd
> >
> > Any guidance would be most welcome.
> >
> > Kind regards
> > Henti Smith
>
> Hi Henti,
>
> you can [Match] onto basically everything provided by `udevadm info
> /sys/class/net/<device_name>`.
>
> See `man:systemd.link` for further information.
>
> BR
> Silvio
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20240815/5676e9ab/attachment.htm>


More information about the systemd-devel mailing list