From bf5407992f54440b586e1d0b3792f93eb2c464f3 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 12 May 2017 12:00:20 +0200 Subject: [PATCH] device: update external configuration before commit If the platform signaled that the external configuration changed (and thus update_ipX_config() is scheduled) and we are doing a commit of the new configuration, update priv->ext_ipX_config. Without this, the commit will remove addresses added externally but not yet captured in the external configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1449873 (cherry picked from commit a21b8882cc9defc43248afc94bf59ca0f84f0d27) --- src/devices/nm-device.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4a2847b902..50a21c4445 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -5487,8 +5487,15 @@ ip4_config_merge_and_apply (NMDevice *self, composite = nm_ip4_config_new (nm_device_get_ip_ifindex (self)); init_ip4_config_dns_priority (self, composite); - if (commit) + if (commit) { ensure_con_ip4_config (self); + if (priv->queued_ip4_config_id) { + g_clear_object (&priv->ext_ip4_config); + priv->ext_ip4_config = nm_ip4_config_capture (nm_device_get_platform (self), + nm_device_get_ifindex (self), + FALSE); + } + } if (priv->dev_ip4_config) { nm_ip4_config_merge (composite, priv->dev_ip4_config, @@ -6223,8 +6230,18 @@ ip6_config_merge_and_apply (NMDevice *self, NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); init_ip6_config_dns_priority (self, composite); - if (commit) + if (commit) { ensure_con_ip6_config (self); + if (priv->queued_ip6_config_id) { + g_clear_object (&priv->ext_ip6_config); + g_clear_object (&priv->ext_ip6_config_captured); + priv->ext_ip6_config_captured = nm_ip6_config_capture (nm_device_get_platform (self), + nm_device_get_ifindex (self), + FALSE, + NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); + priv->ext_ip6_config = nm_ip6_config_new_cloned (priv->ext_ip6_config_captured); + } + } /* Merge all the IP configs into the composite config */ if (priv->ac_ip6_config) {