From bc8d07a733c861a045a3960aa97acb074afa45a7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 2 Nov 2011 15:27:24 -0500 Subject: [PATCH] Revert "dns: don't update routing and DNS if no devices were ever managed" This reverts commit 0051b44a09d67b50b548320233bb8d96d5c8018f. While fixing up the patch I (dcbw) forgot to include the lp# in the commit message. --- src/dns-manager/nm-dns-manager.c | 21 ++++++++------------- src/nm-policy.c | 9 --------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index ddfd47c841..0203f2bb86 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -1097,20 +1097,15 @@ dispose (GObject *object) g_slist_free (priv->plugins); priv->plugins = NULL; - /* If last_iface is NULL, this means we haven't done a DNS update before, - * so no reason to try and take down entries from resolv.conf. + /* If we're quitting leave a valid resolv.conf in place, not one + * pointing to 127.0.0.1 if any plugins were active. Thus update + * DNS after disposing of all plugins. */ - if (priv->last_iface != NULL) { - /* If we're quitting leave a valid resolv.conf in place, not one - * pointing to 127.0.0.1 if any plugins were active. Thus update - * DNS after disposing of all plugins. - */ - if (!update_dns (self, priv->last_iface, TRUE, &error)) { - nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s", - error ? error->code : -1, - error && error->message ? error->message : "(unknown)"); - g_clear_error (&error); - } + if (!update_dns (self, priv->last_iface, TRUE, &error)) { + nm_log_warn (LOGD_DNS, "could not commit DNS changes on shutdown: (%d) %s", + error ? error->code : -1, + error && error->message ? error->message : "(unknown)"); + g_clear_error (&error); } g_slist_foreach (priv->configs, (GFunc) g_object_unref, NULL); diff --git a/src/nm-policy.c b/src/nm-policy.c index 669db28b00..cd8245ed71 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1042,15 +1042,6 @@ device_state_changed (NMDevice *device, update_routing_and_dns (policy, FALSE); break; case NM_DEVICE_STATE_UNMANAGED: - if ( old_state == NM_DEVICE_STATE_UNAVAILABLE - || old_state == NM_DEVICE_STATE_DISCONNECTED) { - /* If the device was never activated, there's no point in - * updating routing or DNS. This allows us to keep the previous - * resolv.conf or routes from before NM started if no device was - * ever managed by NM. - */ - break; - } case NM_DEVICE_STATE_UNAVAILABLE: update_routing_and_dns (policy, FALSE); break;