From 19491cc90f52704c32f129aa804f43045151c873 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 Sep 2024 17:07:11 +0200 Subject: [PATCH 1/2] net_id: depending on new udev prop, include/exclude PCI domain from netif names --- src/udev/udev-builtin-net_id.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 09c04b9a7fe..01a5dda6af8 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -650,7 +650,16 @@ static int get_pci_slot_specifiers( * where the slot makes up the upper 5 bits. */ func += slot * 8; - if (domain > 0 && asprintf(&domain_spec, "P%u", domain) < 0) + /* Include the PCI domain in the name if the ID_NET_NAME_INCLUDE_DOMAIN property says so, if it is + * set. If it is not set, include it if the domain is non-zero. */ + r = device_get_property_bool(dev, "ID_NET_NAME_INCLUDE_DOMAIN"); + if (r < 0) { + if (r != -ENOENT) + log_device_warning_errno(dev, r, "Failed to read property \"ID_NET_NAME_INCLUDE_DOMAIN\", ignoring: %m"); + + r = domain > 0; + } + if (r > 0 && asprintf(&domain_spec, "P%u", domain) < 0) return log_oom_debug(); if (asprintf(&bus_and_slot_spec, "p%us%u", bus, slot) < 0) From 9311c28b3407fbad69d0b747129b03ce1c7a6309 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 Sep 2024 17:13:00 +0200 Subject: [PATCH 2/2] hwdb: disable inclusion of the PCI domain in MANA network interface naming --- hwdb.d/20-net-ifname.hwdb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hwdb.d/20-net-ifname.hwdb b/hwdb.d/20-net-ifname.hwdb index 2408dc172fa..ba136860a8d 100644 --- a/hwdb.d/20-net-ifname.hwdb +++ b/hwdb.d/20-net-ifname.hwdb @@ -3,3 +3,7 @@ # Dell iDRAC Virtual USB NIC usb:v413CpA102* ID_NET_NAME_FROM_DATABASE=idrac + +# Disable inclusion of PCI domain in interface names on Azure MANA +pci:v00001414d000000BA* + ID_NET_NAME_INCLUDE_DOMAIN=0