From 8c053c83ae3c18342c4faaa0043d787884056614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 9 May 2019 12:41:52 +0200 Subject: [PATCH] udev: drop "en" prefix from ID_NET_NAME_ONBOARD The comment in udev-builtin-net_id.c (removed in grandparent commit) showed the property without the prefix. I assume that was always the intent, because it doesn't make much sense to concatenate anything to an arbitrary user-specified field. --- man/systemd.net-naming-scheme.xml | 6 ++++-- src/udev/net/naming-scheme.h | 3 ++- src/udev/udev-builtin-net_id.c | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml index f86ad8d63a9..eb8faad254e 100644 --- a/man/systemd.net-naming-scheme.xml +++ b/man/systemd.net-naming-scheme.xml @@ -309,6 +309,9 @@ Support for netdevsim (simulated networking devices) was added. Previously those devices were not renamed. + + Previously two-letter interface type prefix was prepended to + ID_NET_LABEL_ONBOARD=. This is not done anymore. Note that latest may be used to denote the latest scheme known (to this @@ -336,9 +339,8 @@ ID_NET_NAME_PATH=enp0s31f6 PCI Ethernet card with firmware index "1" ID_NET_NAME_ONBOARD=eno1 -ID_NET_NAME_ONBOARD_LABEL=enEthernet Port 1 +ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1 - diff --git a/src/udev/net/naming-scheme.h b/src/udev/net/naming-scheme.h index f27e1e0d3c3..4061eec99e7 100644 --- a/src/udev/net/naming-scheme.h +++ b/src/udev/net/naming-scheme.h @@ -28,12 +28,13 @@ typedef enum NamingSchemeFlags { NAMING_ZERO_ACPI_INDEX = 1 << 3, /* Use zero acpi_index field, see d81186ef4f6a888a70f20a1e73a812d6acb9e22f */ NAMING_ALLOW_RERENAMES = 1 << 4, /* Allow re-renaming of devices, see #9006 */ NAMING_NETDEVSIM = 1 << 5, /* Generate names for netdevsim devices, see eaa9d507d85509c8bf727356e3884ec54b0fc646 */ + NAMING_LABEL_NOPREFIX = 1 << 6, /* Don't prepend ID_NET_LABEL_ONBOARD with interface type prefix */ /* And now the masks that combine the features above */ NAMING_V238 = 0, NAMING_V239 = NAMING_V238 | NAMING_SR_IOV_V | NAMING_NPAR_ARI, NAMING_V240 = NAMING_V239 | NAMING_INFINIBAND | NAMING_ZERO_ACPI_INDEX | NAMING_ALLOW_RERENAMES, - NAMING_V243 = NAMING_V240 | NAMING_NETDEVSIM, + NAMING_V243 = NAMING_V240 | NAMING_NETDEVSIM | NAMING_LABEL_NOPREFIX, _NAMING_SCHEME_FLAGS_INVALID = -1, } NamingSchemeFlags; diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 8fa8ee3d5a9..c487bc00df2 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -881,7 +881,9 @@ static int builtin_net_id(sd_device *dev, int argc, char *argv[], bool test) { udev_builtin_add_property(dev, test, "ID_NET_NAME_ONBOARD", str); if (names.pci_onboard_label && - snprintf_ok(str, sizeof str, "%s%s", prefix, names.pci_onboard_label)) + snprintf_ok(str, sizeof str, "%s%s", + naming_scheme_has(NAMING_LABEL_NOPREFIX) ? "" : prefix, + names.pci_onboard_label)) udev_builtin_add_property(dev, test, "ID_NET_LABEL_ONBOARD", str); if (names.pci_path[0] &&