dns: rewrite "resolv.conf" on SIGHUP and SIGUSR1

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
(cherry picked from commit 68f1203c7c)
This commit is contained in:
Thomas Haller 2015-06-25 21:31:22 +02:00
parent c16a9665a3
commit 2ce2f1f946

View file

@ -1141,14 +1141,16 @@ config_changed_cb (NMConfig *config,
{
GError *error = NULL;
if (!(changes & NM_CONFIG_CHANGE_DNS_MODE))
return;
if (NM_FLAGS_HAS (changes, NM_CONFIG_CHANGE_DNS_MODE))
init_resolv_conf_mode (self);
init_resolv_conf_mode (self);
if (!update_dns (self, TRUE, &error)) {
nm_log_warn (LOGD_DNS, "could not commit DNS changes: (%d) %s",
error->code, error->message);
g_clear_error (&error);
if (NM_FLAGS_ANY (changes, NM_CONFIG_CHANGE_SIGHUP |
NM_CONFIG_CHANGE_SIGUSR1 |
NM_CONFIG_CHANGE_DNS_MODE)) {
if (!update_dns (self, TRUE, &error)) {
nm_log_warn (LOGD_DNS, "could not commit DNS changes: %s", error->message);
g_clear_error (&error);
}
}
}