diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml index d21b858a5d..9211e25aa1 100644 --- a/man/systemd.net-naming-scheme.xml +++ b/man/systemd.net-naming-scheme.xml @@ -552,6 +552,15 @@ + + + v259 + + The naming scheme based on devicetree aliases was extended to support WLAN devices. + + + + Note that latest may be used to denote the latest scheme known (to this diff --git a/src/shared/netif-naming-scheme.c b/src/shared/netif-naming-scheme.c index afa5b9d842..df16e69fb6 100644 --- a/src/shared/netif-naming-scheme.c +++ b/src/shared/netif-naming-scheme.c @@ -29,6 +29,7 @@ static const NamingScheme naming_schemes[] = { { "v255", NAMING_V255 }, { "v257", NAMING_V257 }, { "v258", NAMING_V258 }, + { "v259", NAMING_V259 }, /* … add more schemes here, as the logic to name devices is updated … */ EXTRA_NET_NAMING_MAP diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h index 18696726c3..504ffec535 100644 --- a/src/shared/netif-naming-scheme.h +++ b/src/shared/netif-naming-scheme.h @@ -42,6 +42,7 @@ typedef enum NamingSchemeFlags { NAMING_FIRMWARE_NODE_SUN = 1 << 18, /* Use firmware_node/sun to get PCI slot number */ NAMING_DEVICETREE_PORT_ALIASES = 1 << 19, /* Include aliases of OF nodes of a netdev itself, not just its parent. See PR #33958. */ NAMING_USE_INTERFACE_PROPERTY = 1 << 20, /* Use INTERFACE udev property, rather than sysname, when no renaming is requested. */ + NAMING_DEVICETREE_ALIASES_WLAN = 1 << 21, /* Generate names from devicetree aliases for WLAN devices */ /* And now the masks that combine the features above */ NAMING_V238 = 0, @@ -63,6 +64,7 @@ typedef enum NamingSchemeFlags { NAMING_V255 = NAMING_V254 & ~NAMING_BRIDGE_MULTIFUNCTION_SLOT, NAMING_V257 = NAMING_V255 | NAMING_FIRMWARE_NODE_SUN | NAMING_DEVICETREE_PORT_ALIASES, NAMING_V258 = NAMING_V257 | NAMING_USE_INTERFACE_PROPERTY, + NAMING_V259 = NAMING_V258 | NAMING_DEVICETREE_ALIASES_WLAN, EXTRA_NET_NAMING_SCHEMES diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index fd80538638..0724de8241 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -910,7 +910,13 @@ static int names_devicetree(UdevEvent *event, const char *prefix) { if (streq(prefix, "en")) r = names_devicetree_alias_prefix(event, prefix, "ethernet"); - else + else if (naming_scheme_has(NAMING_DEVICETREE_ALIASES_WLAN) && + streq(prefix, "wl")) { + r = names_devicetree_alias_prefix(event, prefix, "wifi"); + /* Sometimes DeviceTrees have WLAN devices with alias ethernetN, fall back to those */ + if (r == 0) + r = names_devicetree_alias_prefix(event, prefix, "ethernet"); + } else return -EOPNOTSUPP; /* Unsupported interface type */ if (r < 0) return r;