diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2017-03-20 19:21:05 +0100 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2017-03-23 17:05:19 +0100 |
commit | 3ebe71cf064b2ccfa5b4a9423a9725b11f603ffa (patch) | |
tree | d761a016896126c1e9f9b56a136f2bf76f06a524 /src | |
parent | 6a77258f4ec23cfe15d944d0f106118a96c6f780 (diff) | |
download | NetworkManager-3ebe71cf064b2ccfa5b4a9423a9725b11f603ffa.tar.gz |
dns: avoid cleaning resolv.conf on exit if not needed
When rc-manager=file other services may overwrite resolv.conf at any
time. We don't support merging configurations in resolv.conf but we can
be more tolerant avoiding updating resolv.conf when not strictly needed.
In this case, if the last write of resolv.conf had no nameservers (nor
options), reset the "dns_touched" flag in order to avoid resetting
resolv.conf when quitting (so, potentially overwriting some other
service configuration there).
https://bugzilla.redhat.com/show_bug.cgi?id=1426748
Diffstat (limited to 'src')
-rw-r--r-- | src/dns/nm-dns-manager.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 9b848bab80..baea47b07e 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -1186,6 +1186,10 @@ update_dns (NMDnsManager *self, case NM_DNS_MANAGER_RESOLV_CONF_MAN_FILE: result = update_resolv_conf (self, searches, nameservers, options, error, priv->rc_manager); resolv_conf_updated = TRUE; + /* If we have ended with no nameservers avoid updating again resolv.conf + * on stop, as some external changes may be applied to it in the meanwhile */ + if (!nameservers && !options) + priv->dns_touched = FALSE; break; case NM_DNS_MANAGER_RESOLV_CONF_MAN_RESOLVCONF: result = dispatch_resolvconf (self, searches, nameservers, options, error); |