summary refs log tree commit diff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-04-20 21:11:10 +0200
committerMichael Biebl <biebl@debian.org>2016-04-20 21:11:10 +0200
commit78c3b8801ecf4975e5da1af3b10ae20dd2d876de (patch)
tree19b80fbe9429f554a48ed126911026d4fa8a4b3f /src/nm-manager.c
parent288a08a3672a89a9bfdb8354b6863cc039759fc2 (diff)
Imported Upstream version 1.2.0 upstream/1.2.0
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 289a91d6..e64c68af 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -833,13 +833,13 @@ remove_device (NMManager *self,
                gboolean allow_unmanage)
 {
 	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+	gboolean unmanage = FALSE;
 
 	_LOGD (LOGD_DEVICE, "(%s): removing device (allow_unmanage %d, managed %d)",
 	       nm_device_get_iface (device), allow_unmanage, nm_device_get_managed (device, FALSE));
 
 	if (allow_unmanage && nm_device_get_managed (device, FALSE)) {
 		NMActRequest *req = nm_device_get_act_request (device);
-		gboolean unmanage = FALSE;
 
 		/* Leave activated interfaces up when quitting so their configuration
 		 * can be taken over when NM restarts.  This ensures connectivity while
@@ -869,7 +869,18 @@ remove_device (NMManager *self,
 	priv->devices = g_slist_remove (priv->devices, device);
 
 	if (nm_device_is_real (device)) {
-		nm_device_removed (device);
+		gboolean unconfigure_ip_config = !quitting || unmanage;
+
+		/* When we don't unmanage the device on shutdown, we want to preserve the DNS
+		 * configuration in resolv.conf. For that, we must leak the configuration
+		 * in NMPolicy/NMDnsManager. We do that, by emitting the device-removed signal
+		 * with device's ip-config object still uncleared. In that case, NMPolicy
+		 * never learns to unconfigure the ip-config objects and does not remove them
+		 * from DNS on shutdown (which is ugly, because we don't cleanup the memory
+		 * properly).
+		 *
+		 * Control that by passing @unconfigure_ip_config.  */
+		nm_device_removed (device, unconfigure_ip_config);
 
 		g_signal_emit (self, signals[DEVICE_REMOVED], 0, device);
 		_notify (self, PROP_DEVICES);
@@ -3512,7 +3523,6 @@ activation_add_done (NMSettings *settings,
 	                            FALSE,
 	                            nm_active_connection_get_subject (active),
 	                            error->message);
-	g_object_unref (active);
 	g_clear_error (&local);
 }