summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-07-01 09:01:10 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-07-21 10:13:12 +0200
commit01399955906aa1b1e52998e8daf487b30fa6eb81 (patch)
tree1e8eb3eccdbda688b749257c806554dedf5b52d8
parent127294babc23782781c17192c52a2d57f7916170 (diff)
downloadNetworkManager-01399955906aa1b1e52998e8daf487b30fa6eb81.tar.gz
ovs: also set cloned MAC address via netlink
We already set the MAC of OVS interfaces in the ovsdb. Unfortunately, vswitchd doesn't create the interface with the given MAC from the beginning, but first creates it with a random MAC and then changes it. This causes a race condition: as soon as NM sees the new link, it starts IP configuration on it and (possibly later) vswitchd will change the MAC. To avoid this, also set the desired MAC via netlink before starting IP configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1852106 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/483 (cherry picked from commit 47ec3d14d49eb9e9db956b3efd495d5d696da996) (cherry picked from commit 60d10b146d57290f146536705d744e67925de90e)
-rw-r--r--src/devices/ovs/nm-device-ovs-interface.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c
index 10f9fa9431..83954cf075 100644
--- a/src/devices/ovs/nm-device-ovs-interface.c
+++ b/src/devices/ovs/nm-device-ovs-interface.c
@@ -104,6 +104,14 @@ link_changed (NMDevice *device,
priv->waiting_for_interface = FALSE;
if (nm_device_get_state (device) == NM_DEVICE_STATE_IP_CONFIG) {
+ if (!nm_device_hw_addr_set_cloned (device,
+ nm_device_get_applied_connection (device),
+ FALSE)) {
+ nm_device_state_changed (device,
+ NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_CONFIG_FAILED);
+ return;
+ }
nm_device_bring_up (device, TRUE, NULL);
nm_device_activate_schedule_stage3_ip_config_start (device);
}
@@ -176,6 +184,13 @@ act_stage3_ip_config_start (NMDevice *device,
return NM_ACT_STAGE_RETURN_POSTPONE;
}
+ if (!nm_device_hw_addr_set_cloned (device,
+ nm_device_get_applied_connection (device),
+ FALSE)) {
+ *out_failure_reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
+ return NM_ACT_STAGE_RETURN_FAILURE;
+ }
+
return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
}