From 21486d9e99463b0dc1f3ff9b9f3846aa67ffca6d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 31 Oct 2018 12:35:25 +0900 Subject: [PATCH] network: also monitor udev 'change' event for network interfaces If networkd starts earlier than all network interfaces are initialized, then uninitialized interfaces are staying in pending state and cannot become up. With this, such interfaces are started after receiving 'change' event. --- src/network/networkd-manager.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index f7e9b486096..7433be96ffb 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -12,6 +12,7 @@ #include "bus-util.h" #include "conf-parser.h" #include "def.h" +#include "device-util.h" #include "dns-domain.h" #include "fd-util.h" #include "fileio.h" @@ -21,6 +22,7 @@ #include "ordered-set.h" #include "path-util.h" #include "set.h" +#include "strv.h" #include "virt.h" /* use 8 MB for receive socket kernel queue. */ @@ -193,12 +195,19 @@ static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *devi assert(device); r = sd_device_get_property_value(device, "ACTION", &action); - if (r < 0 || !streq_ptr(action, "add")) + if (r < 0) { + log_device_debug_errno(device, r, "Failed to get 'ACTION' property, ignoring device: %m"); return 0; + } + + if (!STR_IN_SET(action, "add", "change")) { + log_device_debug(device, "Ignoring udev %s event for device: %m", action); + return 0; + } r = sd_device_get_ifindex(device, &ifindex); if (r < 0) { - log_debug_errno(r, "Ignoring udev ADD event for device without ifindex or with invalid ifindex: %m"); + log_device_debug_errno(device, r, "Ignoring udev ADD event for device without ifindex or with invalid ifindex: %m"); return 0; } -- 2.47.3