diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-12 14:07:14 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-14 02:18:29 +0200 |
commit | 1a3caa49d757ed0b90f86d0f1c3eee55a1588e61 (patch) | |
tree | deed0a1663b26e3a83816c789f5b6059e9caba51 /src/udev | |
parent | network: move and rename network_get() -> link_get_network() (diff) | |
download | systemd-1a3caa49d757ed0b90f86d0f1c3eee55a1588e61.tar.xz systemd-1a3caa49d757ed0b90f86d0f1c3eee55a1588e61.zip |
udev,network: make link_get_type_string() return negative errno on failure
And make net_match_config() propagate the error.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/net/link-config.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 87afe8383a..3685c9d228 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -273,16 +273,20 @@ int link_config_get(link_config_ctx *ctx, sd_device *device, link_config **ret) (void) link_unsigned_attribute(device, "name_assign_type", &name_assign_type); LIST_FOREACH(links, link, ctx->links) { - if (net_match_config(&link->match, device, NULL, &permanent_mac, NULL, iftype, NULL, NULL, 0, NULL, NULL)) { - if (link->match.ifname && !strv_contains(link->match.ifname, "*") && 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; - } + r = net_match_config(&link->match, device, NULL, &permanent_mac, NULL, iftype, NULL, NULL, 0, NULL, NULL); + if (r < 0) + return r; + if (r == 0) + continue; + + if (link->match.ifname && !strv_contains(link->match.ifname, "*") && 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; } return -ENOENT; |