diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-27 00:23:32 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-27 00:46:51 +0100 |
commit | 452b4e327d23b9e468d3198f4c91e8efd0b52a71 (patch) | |
tree | 58d85aa448f25111d026c58ab1737d21723bb628 /src/resolve/resolved-resolv-conf.c | |
parent | bf7fabd6000fd95495904ed55db62caf361b3d8f (diff) |
resolved: flush the global DNS cache if /etc/resolv.conf is touched
After all /etc/resolv.conf is usually done when the network
configuration changes, which is a good reason to flush the global cache.
See: #2038
Diffstat (limited to 'src/resolve/resolved-resolv-conf.c')
-rw-r--r-- | src/resolve/resolved-resolv-conf.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index 63bde1c2f4..956f380f3c 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -129,6 +129,15 @@ int manager_read_resolv_conf(Manager *m) { * resolve VPN domains. */ manager_set_dns_server(m, m->dns_servers); + /* Unconditionally flush the cache when /etc/resolv.conf is + * modified, even if the data it contained was completely + * identical to the previous version we used. We do this + * because altering /etc/resolv.conf is typically done when + * the network configuration changes, and that should be + * enough to flush the global unicast DNS cache. */ + if (m->unicast_scope) + dns_cache_flush(&m->unicast_scope->cache); + return 0; clear: |