Blame SOURCES/0016-ovs-interface-dhcp-twice-rh1540063.patch

c48088
From a645c8dd7190aa075227728e5f234a5169bfbab1 Mon Sep 17 00:00:00 2001
c48088
From: Lubomir Rintel <lkundrak@v3.sk>
c48088
Date: Fri, 2 Feb 2018 17:25:04 +0100
c48088
Subject: [PATCH] ovs-interface: avoid starting ip[46] configuration more than
c48088
 once
c48088
c48088
OvsInterface can postpone the stage3_ip[46]_config until the link
c48088
actually appears. It ought to restart the stage only when the link
c48088
appears, not upon further changes to it (which would trip an assertion
c48088
when starting the DHCP client while one already exists).
c48088
c48088
https://bugzilla.redhat.com/show_bug.cgi?id=1540063
c48088
---
c48088
 src/devices/ovs/nm-device-ovs-interface.c | 24 +++++++++++++++++++++---
c48088
 1 file changed, 21 insertions(+), 3 deletions(-)
c48088
c48088
diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c
c48088
index 426521c52..1342ed948 100644
c48088
--- a/src/devices/ovs/nm-device-ovs-interface.c
c48088
+++ b/src/devices/ovs/nm-device-ovs-interface.c
c48088
@@ -35,8 +35,13 @@ _LOG_DECLARE_SELF(NMDeviceOvsInterface);
c48088
 
c48088
 /*****************************************************************************/
c48088
 
c48088
+typedef struct {
c48088
+	gboolean waiting_for_interface;
c48088
+} NMDeviceOvsInterfacePrivate;
c48088
+
c48088
 struct _NMDeviceOvsInterface {
c48088
 	NMDevice parent;
c48088
+	NMDeviceOvsInterfacePrivate _priv;
c48088
 };
c48088
 
c48088
 struct _NMDeviceOvsInterfaceClass {
c48088
@@ -45,6 +50,8 @@ struct _NMDeviceOvsInterfaceClass {
c48088
 
c48088
 G_DEFINE_TYPE (NMDeviceOvsInterface, nm_device_ovs_interface, NM_TYPE_DEVICE)
c48088
 
c48088
+#define NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceOvsInterface, NM_IS_DEVICE_OVS_INTERFACE)
c48088
+
c48088
 /*****************************************************************************/
c48088
 
c48088
 static const char *
c48088
@@ -109,7 +116,10 @@ static void
c48088
 link_changed (NMDevice *device,
c48088
               const NMPlatformLink *pllink)
c48088
 {
c48088
-	if (nm_device_get_state (device) == NM_DEVICE_STATE_IP_CONFIG) {
c48088
+	NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
c48088
+
c48088
+	if (priv->waiting_for_interface) {
c48088
+		priv->waiting_for_interface = FALSE;
c48088
 		nm_device_bring_up (device, TRUE, NULL);
c48088
 		nm_device_activate_schedule_stage3_ip_config_start (device);
c48088
 	}
c48088
@@ -131,11 +141,15 @@ act_stage3_ip4_config_start (NMDevice *device,
c48088
                              NMIP4Config **out_config,
c48088
                              NMDeviceStateReason *out_failure_reason)
c48088
 {
c48088
+	NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
c48088
+
c48088
 	if (!_is_internal_interface (device))
c48088
 		return NM_ACT_STAGE_RETURN_IP_FAIL;
c48088
 
c48088
-	if (!nm_device_get_ip_ifindex (device))
c48088
+	if (!nm_device_get_ip_ifindex (device)) {
c48088
+		priv->waiting_for_interface = TRUE;
c48088
 		return NM_ACT_STAGE_RETURN_POSTPONE;
c48088
+	}
c48088
 
c48088
 	return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
c48088
 }
c48088
@@ -145,11 +159,15 @@ act_stage3_ip6_config_start (NMDevice *device,
c48088
                              NMIP6Config **out_config,
c48088
                              NMDeviceStateReason *out_failure_reason)
c48088
 {
c48088
+	NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
c48088
+
c48088
 	if (!_is_internal_interface (device))
c48088
 		return NM_ACT_STAGE_RETURN_IP_FAIL;
c48088
 
c48088
-	if (!nm_device_get_ip_ifindex (device))
c48088
+	if (!nm_device_get_ip_ifindex (device)) {
c48088
+		priv->waiting_for_interface = TRUE;
c48088
 		return NM_ACT_STAGE_RETURN_POSTPONE;
c48088
+	}
c48088
 
c48088
 	return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
c48088
 }
c48088
-- 
c48088
2.14.3
c48088