From 755fa19e5db48f224abad310d4ac7fce34047ca2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 13 Oct 2014 11:58:26 -0500 Subject: core: remove child devices without deconfiguring them (bgo #738479) When a child device is found and an IP configuration already exists for it even though it is under NM control (like when pppd applies IP config to a WWAN device before NM gets the IP details from the pppd plugin), don't deconfigure the child device when removing it from the device list, because this breaks the device's configuration. https://bugzilla.gnome.org/show_bug.cgi?id=738479 (cherry picked from commit 5ad69cb29b7c9de7e06374058f49cd62ccbe187a) --- src/nm-manager.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 8beb734c61..55330ea594 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -129,7 +129,6 @@ static void impl_manager_check_connectivity (NMManager *manager, #include "nm-manager-glue.h" static void add_device (NMManager *self, NMDevice *device, gboolean generate_con); -static void remove_device (NMManager *self, NMDevice *device, gboolean quitting); static NMActiveConnection *_new_active_connection (NMManager *self, NMConnection *connection, @@ -742,11 +741,14 @@ device_has_pending_action_changed (NMDevice *device, } static void -remove_device (NMManager *manager, NMDevice *device, gboolean quitting) +remove_device (NMManager *manager, + NMDevice *device, + gboolean quitting, + gboolean allow_unmanage) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - if (nm_device_get_managed (device)) { + if (allow_unmanage && nm_device_get_managed (device)) { NMActRequest *req = nm_device_get_act_request (device); gboolean unmanage = FALSE; @@ -787,7 +789,7 @@ remove_device (NMManager *manager, NMDevice *device, gboolean quitting) static void device_removed_cb (NMDevice *device, gpointer user_data) { - remove_device (NM_MANAGER (user_data), device, FALSE); + remove_device (NM_MANAGER (user_data), device, FALSE, TRUE); } static void @@ -1733,7 +1735,7 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con) remove = g_slist_prepend (remove, iter->data); } for (iter = remove; iter; iter = iter->next) - remove_device (self, NM_DEVICE (iter->data), FALSE); + remove_device (self, NM_DEVICE (iter->data), FALSE, FALSE); g_slist_free (remove); priv->devices = g_slist_append (priv->devices, g_object_ref (device)); @@ -2200,7 +2202,7 @@ platform_link_cb (NMPlatform *platform, device = find_device_by_ifindex (self, ifindex); if (device) - remove_device (self, device, FALSE); + remove_device (self, device, FALSE, TRUE); break; } default: @@ -5003,7 +5005,7 @@ dispose (GObject *object) /* Remove all devices */ while (priv->devices) - remove_device (manager, NM_DEVICE (priv->devices->data), TRUE); + remove_device (manager, NM_DEVICE (priv->devices->data), TRUE, TRUE); if (priv->ac_cleanup_id) { g_source_remove (priv->ac_cleanup_id); -- cgit v1.2.1