[systemd-commits] src/resolve

Lennart Poettering lennart at kemper.freedesktop.org
Fri Jan 23 10:04:30 PST 2015


 src/resolve/resolved-manager.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 36a03ca2a8952ca1acb29fbe796210c27ff71aff
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jan 23 18:57:29 2015 +0100

    resolved: when rereading /etc/resolv.conf, always start using first DNS server again
    
    Previously we tried to stick to a DNS server as long as it is available.
    When /etc/resolv.conf changed, and the old DNS server we used was still
    in there we'd continue to use it, even if it was at the end of the list.
    
    With this change we'll now always start with the first DNS server in the
    list again.
    
    Rationale: certain network managing implementations (notably
    NetworkManager) when connected to a VPN place both the VPN DNS server as
    well as the local DNS server in /etc/resolv.conf. If we used the local
    one before we would thus continue to use the local one, making VPN names
    unresolvable. NetworkManager really should be fixed to only place the
    VPN DNS servers in the file, but with this commit things are at least
    similarly bad as they used to be...

diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 0594479..2edfb9f 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -667,6 +667,16 @@ int manager_read_resolv_conf(Manager *m) {
                 if (s->marked)
                         dns_server_free(s);
 
+        /* Whenever /etc/resolv.conf changes, start using the first
+         * DNS server of it. This is useful to deal with broken
+         * network managing implementations (like NetworkManager),
+         * that when connecting to a VPN place both the VPN DNS
+         * servers and the local ones in /etc/resolv.conf. Without
+         * resetting the DNS server to use back to the first entry we
+         * will continue to use the local one thus being unable to
+         * resolve VPN domains. */
+        manager_set_dns_server(m, m->dns_servers);
+
         return 0;
 
 clear:



More information about the systemd-commits mailing list