From 745d60c06ecccc7cbb0f916d5c62f3f72ac5e60b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 9 Mar 2018 19:16:05 +0100 Subject: [PATCH] device: in nm_device_capture_initial_config() only update config once Now that there is no difference between initial capturing of the configuration, and a later update_ip_config() call during a signal from platform, we only need to make sure that the IP config instances are initialized at least once. In case we are called multiple times, there is nothing to do. --- src/devices/nm-device.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 3cedb7cf05..ad6bf835ec 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -263,6 +263,9 @@ typedef struct _NMDevicePrivate { bool queued_ip4_config_pending:1; bool queued_ip6_config_pending:1; + bool update_ip_config_completed_v4:1; + bool update_ip_config_completed_v6:1; + char * ip_iface; int ip_ifindex; NMDeviceType type; @@ -3626,6 +3629,9 @@ nm_device_realize_finish (NMDevice *self, const NMPlatformLink *plink) if (plink) device_recheck_slave_status (self, plink); + priv->update_ip_config_completed_v4 = FALSE; + priv->update_ip_config_completed_v6 = FALSE; + priv->real = TRUE; _notify (self, PROP_REAL); @@ -11415,6 +11421,11 @@ update_ip_config (NMDevice *self, int addr_family) nm_assert_addr_family (addr_family); + if (addr_family == AF_INET) + priv->update_ip_config_completed_v4 = TRUE; + else + priv->update_ip_config_completed_v6 = TRUE; + if (update_ext_ip_config (self, addr_family, TRUE)) { if (addr_family == AF_INET) { if (priv->ext_ip4_config) @@ -11429,8 +11440,12 @@ update_ip_config (NMDevice *self, int addr_family) void nm_device_capture_initial_config (NMDevice *self) { - update_ip_config (self, AF_INET); - update_ip_config (self, AF_INET6); + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + + if (!priv->update_ip_config_completed_v4) + update_ip_config (self, AF_INET); + if (!priv->update_ip_config_completed_v6) + update_ip_config (self, AF_INET6); } static gboolean