network: do not configure interfaces under renaming

This commit is contained in:
Yu Watanabe 2019-03-04 12:19:05 +09:00
parent 90ba130f00
commit 299ad32d48
2 changed files with 23 additions and 1 deletions

View 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;

View 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)