]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: also monitor udev 'change' event for network interfaces
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 31 Oct 2018 03:35:25 +0000 (12:35 +0900)
committerLennart Poettering <lennart@poettering.net>
Wed, 31 Oct 2018 11:08:34 +0000 (12:08 +0100)
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

index f7e9b48609642dc7a55ad3665eb53a5b22b2eae2..7433be96ffb8de36a94f66ed5f7cd12019fe109c 100644 (file)
@@ -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;
         }