From 33812995621f028eacc891729d373c0ff74de83b Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 11 Dec 2019 11:54:08 +0100 Subject: [PATCH] ovs: check state before starting ip configuration after link change When the link becomes available, check that the device is in the ip-config state before starting ip configuration. Also, reset the 'waiting_for_interface' flag when the device deactivates. https://bugzilla.redhat.com/show_bug.cgi?id=1781165 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/358 (cherry picked from commit 0738c1044524b938f008c111b829db7dabbb8269) --- src/devices/ovs/nm-device-ovs-interface.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c index 4cbb0cd1ff..726e990131 100644 --- a/src/devices/ovs/nm-device-ovs-interface.c +++ b/src/devices/ovs/nm-device-ovs-interface.c @@ -98,7 +98,9 @@ link_changed (NMDevice *device, { NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device); - if (pllink && priv->waiting_for_interface) { + if ( pllink + && priv->waiting_for_interface + && nm_device_get_state (device) == NM_DEVICE_STATE_IP_CONFIG) { priv->waiting_for_interface = FALSE; nm_device_bring_up (device, TRUE, NULL); nm_device_activate_schedule_stage3_ip_config_start (device); @@ -142,6 +144,15 @@ can_unmanaged_external_down (NMDevice *self) return FALSE; } +static void +deactivate (NMDevice *device) +{ + NMDeviceOvsInterface *self = NM_DEVICE_OVS_INTERFACE (device); + NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (self); + + priv->waiting_for_interface = FALSE; +} + /*****************************************************************************/ static void @@ -171,6 +182,7 @@ nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass) device_class->connection_type_check_compatible = NM_SETTING_OVS_INTERFACE_SETTING_NAME; device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_OPENVSWITCH); + device_class->deactivate = deactivate; device_class->get_type_description = get_type_description; device_class->create_and_realize = create_and_realize; device_class->get_generic_capabilities = get_generic_capabilities;