diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-02-12 21:16:27 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-13 09:46:56 +0100 |
commit | 3ec2f7f2e3fc04699d8de27d3cc2e5eecf9a3698 (patch) | |
tree | 054875cd8930ada43f1295e0614f5503e526c94b /src/udev/udev-builtin-net_setup_link.c | |
parent | core: slightly improve error message on load errors (diff) | |
download | systemd-3ec2f7f2e3fc04699d8de27d3cc2e5eecf9a3698.tar.xz systemd-3ec2f7f2e3fc04699d8de27d3cc2e5eecf9a3698.zip |
udev: make net_setup_link builtin quiet when link vanishes while we operate on it
Fixes: #16175
Diffstat (limited to '')
-rw-r--r-- | src/udev/udev-builtin-net_setup_link.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c index cb12b943fe..87e1fb133e 100644 --- a/src/udev/udev-builtin-net_setup_link.c +++ b/src/udev/udev-builtin-net_setup_link.c @@ -1,7 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "device-util.h" #include "alloc-util.h" +#include "device-util.h" +#include "errno-util.h" #include "link-config.h" #include "log.h" #include "string-util.h" @@ -20,7 +21,7 @@ static int builtin_net_setup_link(sd_device *dev, int argc, char **argv, bool te r = link_get_driver(ctx, dev, &driver); if (r < 0) - log_device_full_errno(dev, r == -EOPNOTSUPP ? LOG_DEBUG : LOG_WARNING, + log_device_full_errno(dev, ERRNO_IS_NOT_SUPPORTED(r) || r == -ENODEV ? LOG_DEBUG : LOG_WARNING, r, "Failed to query device driver: %m"); else udev_builtin_add_property(dev, test, "ID_NET_DRIVER", driver); @@ -29,13 +30,17 @@ static int builtin_net_setup_link(sd_device *dev, int argc, char **argv, bool te if (r < 0) { if (r == -ENOENT) return log_device_debug_errno(dev, r, "No matching link configuration found."); + if (r == -ENODEV) + return log_device_debug_errno(dev, r, "Link vanished while searching for configuration for it."); return log_device_error_errno(dev, r, "Failed to get link config: %m"); } r = link_config_apply(ctx, link, dev, &name); - if (r < 0) - log_device_warning_errno(dev, r, "Could not apply link config, ignoring: %m"); + if (r == -ENODEV) + log_device_debug_errno(dev, r, "Link vanished while applying configuration, ignoring."); + else if (r < 0) + log_device_warning_errno(dev, r, "Could not apply link configuration, ignoring: %m"); udev_builtin_add_property(dev, test, "ID_NET_LINK_FILE", link->filename); |