Commit 9498ea50 authored by Lubomir Rintel's avatar Lubomir Rintel 🥕 Committed by Thomas Haller
Browse files

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 f72816bf

,
which was reverted.
Co-Authored-By: Thomas Haller's avatarThomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=764483
parent c5d82705
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment