summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-04-04 16:58:33 +0200
committerThomas Haller <thaller@redhat.com>2016-04-04 23:10:20 +0200
commit9498ea507eb1d5042736c4351337e91b9c13bdf6 (patch)
tree0324709fb3faea4d021581fae40892f420b96c4d
parentc5d827057e71e349a02922982323d2e8a85081c8 (diff)
downloadNetworkManager-9498ea507eb1d5042736c4351337e91b9c13bdf6.tar.gz
manager: ensure IP config of device is cleared before removal
If the manager removes the device, the IP config objects must be cleared. The reason is that NMPolicy registers to the IP config changed signal and passes these object on to NMDnsManager. If the INTERNAL_DEVICE_REMOVED signal is emited with IP configuration object pending, those objects will be leaked. This partly redoes commit f72816bf108cf3fa52ae267e3622a1f19db28b21, which was reverted. Co-Authored-By: Thomas Haller <thaller@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=764483
-rw-r--r--src/devices/nm-device.c12
-rw-r--r--src/nm-manager.c3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 2edc9b1f4b..dde9af9481 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -2585,6 +2585,18 @@ nm_device_removed (NMDevice *self)
* Release the slave from master, but don't touch the device. */
nm_device_master_release_one_slave (priv->master, self, FALSE, NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
}
+
+ /* Clean up IP configs; this does not actually deconfigure the
+ * interface, it just clears the configuration to which policy
+ * is reacting via NM_DEVICE_IP4_CONFIG_CHANGED/NM_DEVICE_IP6_CONFIG_CHANGED
+ * signal. As NMPolicy registered the NMIPxConfig instances in NMDnsManager,
+ * these would be leaked otherwise. */
+ priv->default_route.v4_has = FALSE;
+ priv->default_route.v4_is_assumed = TRUE;
+ nm_device_set_ip4_config (self, NULL, 0, FALSE, FALSE, NULL);
+ priv->default_route.v6_has = FALSE;
+ priv->default_route.v6_is_assumed = TRUE;
+ nm_device_set_ip6_config (self, NULL, FALSE, FALSE, NULL);
}
static gboolean
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 645f96f5fc..289a91d6c7 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -869,9 +869,10 @@ remove_device (NMManager *self,
priv->devices = g_slist_remove (priv->devices, device);
if (nm_device_is_real (device)) {
+ nm_device_removed (device);
+
g_signal_emit (self, signals[DEVICE_REMOVED], 0, device);
_notify (self, PROP_DEVICES);
- nm_device_removed (device);
}
g_signal_emit (self, signals[INTERNAL_DEVICE_REMOVED], 0, device);
_notify (self, PROP_ALL_DEVICES);