From: Yu Watanabe Date: Mon, 14 Sep 2020 09:28:29 +0000 (+0900) Subject: udev: allow to match OriginalName= with renamed interface name X-Git-Tag: v247-rc1~78^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f57673025680fdca0c200e7ca7a37fed943d2b49;p=thirdparty%2Fsystemd.git udev: allow to match OriginalName= with renamed interface name --- diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 5c871b67179..cb1db3b52b0 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -242,6 +242,7 @@ bool link_config_should_reload(link_config_ctx *ctx) { } int link_config_get(link_config_ctx *ctx, sd_device *device, link_config **ret) { + unsigned name_assign_type = NET_NAME_UNKNOWN; struct ether_addr permanent_mac = {}; unsigned short iftype = 0; link_config *link; @@ -268,30 +269,18 @@ int link_config_get(link_config_ctx *ctx, sd_device *device, link_config **ret) if (r < 0) log_device_debug_errno(device, r, "Failed to get permanent MAC address, ignoring: %m"); + (void) link_unsigned_attribute(device, "name_assign_type", &name_assign_type); + LIST_FOREACH(links, link, ctx->links) { if (net_match_config(link->match_mac, link->match_permanent_mac, link->match_path, link->match_driver, link->match_type, link->match_name, link->match_property, NULL, NULL, NULL, device, NULL, &permanent_mac, NULL, iftype, NULL, NULL, 0, NULL, NULL)) { - if (link->match_name && !strv_contains(link->match_name, "*")) { - unsigned name_assign_type = NET_NAME_UNKNOWN; - - (void) link_unsigned_attribute(device, "name_assign_type", &name_assign_type); - - if (name_assign_type == NET_NAME_ENUM) { - log_device_warning(device, "Config file %s applies to device based on potentially unpredictable interface name", - link->filename); - *ret = link; - - return 0; - } else if (name_assign_type == NET_NAME_RENAMED) { - log_device_warning(device, "Config file %s matches device based on renamed interface name, ignoring", - link->filename); - - continue; - } - } - log_device_debug(device, "Config file %s is applied", link->filename); + if (link->match_name && !strv_contains(link->match_name, "*") && name_assign_type == NET_NAME_ENUM) + log_device_warning(device, "Config file %s is applied to device based on potentially unpredictable interface name.", + link->filename); + else + log_device_debug(device, "Config file %s is applied", link->filename); *ret = link; return 0;