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
This commit is contained in:
Beniamino Galvani 2019-12-11 11:54:08 +01:00
parent bd9b253540
commit 0738c10445

View file

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