]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not configure interfaces under renaming
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 4 Mar 2019 03:19:05 +0000 (12:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Mar 2019 01:33:42 +0000 (10:33 +0900)
src/network/networkd-link.c
src/network/networkd-manager.c

index a5d4ede3744268ff6043cdea2ae5f0c99a3f51a2..9e3cd71a095896f415afd8a64b2acfb7083364c0 100644 (file)
@@ -31,6 +31,7 @@
 #include "strv.h"
 #include "sysctl-util.h"
 #include "tmpfile-util.h"
+#include "udev-util.h"
 #include "util.h"
 #include "virt.h"
 
@@ -3624,6 +3625,16 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
                         return 0;
                 }
 
+                r = device_is_renaming(device);
+                if (r < 0) {
+                        log_link_warning_errno(link, r, "Failed to determine the device is renamed or not: %m");
+                        goto failed;
+                }
+                if (r > 0) {
+                        log_link_debug(link, "Interface is under renaming, pending initialization.");
+                        return 0;
+                }
+
                 r = link_initialized(link, device);
                 if (r < 0)
                         goto failed;
index 079cd3e1d156184f2f8ab9ae782d82853504c37e..c87f907957a9d688e1e96144c331243c07f993b4 100644 (file)
@@ -26,6 +26,7 @@
 #include "strv.h"
 #include "sysctl-util.h"
 #include "tmpfile-util.h"
+#include "udev-util.h"
 #include "virt.h"
 
 /* use 8 MB for receive socket kernel queue. */
@@ -194,7 +195,7 @@ static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *devi
                 return 0;
         }
 
-        if (!STR_IN_SET(action, "add", "change")) {
+        if (!STR_IN_SET(action, "add", "change", "move")) {
                 log_device_debug(device, "Ignoring udev %s event for device.", action);
                 return 0;
         }
@@ -205,6 +206,16 @@ static int manager_udev_process_link(sd_device_monitor *monitor, sd_device *devi
                 return 0;
         }
 
+        r = device_is_renaming(device);
+        if (r < 0) {
+                log_device_error_errno(device, r, "Failed to determine the device is renamed or not, ignoring '%s' uevent: %m", action);
+                return 0;
+        }
+        if (r > 0) {
+                log_device_debug(device, "Interface is under renaming, wait for the interface to be renamed: %m");
+                return 0;
+        }
+
         r = link_get(m, ifindex, &link);
         if (r < 0) {
                 if (r != -ENODEV)