diff options
author | Thomas Haller <thaller@redhat.com> | 2015-06-25 21:31:22 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-06-25 22:02:18 +0200 |
commit | 68f1203c7c33fc26c1eef85465608bce4aa479b7 (patch) | |
tree | 8d6edad88d4095a686aedef93cdb21b10c42acf5 | |
parent | caed15e082efe0af2db3d8a88f72d27640fb381f (diff) | |
download | NetworkManager-th/dns-update-on-sigusr1-rh1062301.tar.gz |
dns: rewrite "resolv.conf" on SIGHUP and SIGUSR1th/dns-update-on-sigusr1-rh1062301
Also rewrite resolv.conf if the configuration didn't actually change.
Especially, react on SIGUSR1 which does not reload the configuration but
only writes "resolv.conf".
https://bugzilla.redhat.com/show_bug.cgi?id=1062301
-rw-r--r-- | src/dns-manager/nm-dns-manager.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 09e3a1d66c..ac4a050ec0 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -1303,15 +1303,19 @@ config_changed_cb (NMConfig *config, { GError *error = NULL; - if (!NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_DNS_MODE | - NM_CONFIG_CHANGE_RC_MANAGER)) - return; - - init_resolv_conf_mode (self); - init_resolv_conf_manager (self); - if (!update_dns (self, TRUE, &error)) { - nm_log_warn (LOGD_DNS, "could not commit DNS changes: %s", error->message); - g_clear_error (&error); + if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_DNS_MODE)) + init_resolv_conf_mode (self); + if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_RC_MANAGER)) + init_resolv_conf_manager (self); + + if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_SIGHUP | + NM_CONFIG_CHANGE_SIGUSR1 | + NM_CONFIG_CHANGE_DNS_MODE | + NM_CONFIG_CHANGE_RC_MANAGER)) { + if (!update_dns (self, TRUE, &error)) { + nm_log_warn (LOGD_DNS, "could not commit DNS changes: %s", error->message); + g_clear_error (&error); + } } } |