diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-06-03 21:29:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-06-06 19:17:38 +0200 |
commit | 2817157bb705e0f3e9ad4a83246a80d026866be3 (patch) | |
tree | 918405f8ded931c2b03273d3c8d2f7f125a5d053 /src/resolve/resolved-resolv-conf.c | |
parent | d5af8eeab83d2c706af5b089539603dc2a434cc2 (diff) |
resolved: support IPv6 DNS servers on the local link
Make sure we can parse DNS server addresses that use the "zone id" syntax for
local link addresses, i.e. "fe80::c256:27ff:febb:12f%wlp3s0", when reading
/etc/resolv.conf.
Also make sure we spit this out correctly again when writing /etc/resolv.conf
and via the bus.
Fixes: #3359
Diffstat (limited to 'src/resolve/resolved-resolv-conf.c')
-rw-r--r-- | src/resolve/resolved-resolv-conf.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/resolve/resolved-resolv-conf.c b/src/resolve/resolved-resolv-conf.c index fa89de4c21..df738e31ef 100644 --- a/src/resolve/resolved-resolv-conf.c +++ b/src/resolve/resolved-resolv-conf.c @@ -92,7 +92,7 @@ int manager_read_resolv_conf(Manager *m) { a = first_word(l, "nameserver"); if (a) { - r = manager_add_dns_server_by_string(m, DNS_SERVER_SYSTEM, a); + r = manager_parse_dns_server_string_and_warn(m, DNS_SERVER_SYSTEM, a); if (r < 0) log_warning_errno(r, "Failed to parse DNS server address '%s', ignoring.", a); @@ -149,9 +149,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) { assert(f); assert(count); - (void) dns_server_string(s); - - if (!s->server_string) { + if (!dns_server_string(s)) { log_warning("Our of memory, or invalid DNS address. Ignoring server."); return; } @@ -160,7 +158,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) { fputs("# Too many DNS servers configured, the following entries may be ignored.\n", f); (*count)++; - fprintf(f, "nameserver %s\n", s->server_string); + fprintf(f, "nameserver %s\n", dns_server_string(s)); } static void write_resolv_conf_search( |