diff options
author | Ulrich Weber <uweber.linux@gmail.com> | 2014-04-23 12:33:04 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-04-24 10:12:37 +0200 |
commit | 235a02424c3ab1b59308895c4f00395dacf2557c (patch) | |
tree | d82a40a2c12d2f6f9747a5a1d82d088699d8c078 | |
parent | 2b3e96c491d6929a518ac2216d93c3dbcfa9bb1a (diff) |
netifd: fix IPv6 Link-local DNS server
interface name must be added to Link-local IPv6
DNS servers, otherwise they are unusable.
Signed-off-by: Ulrich Weber <uw@ocedo.com>
-rw-r--r-- | interface-ip.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/interface-ip.c b/interface-ip.c index d5a3832..6f42015 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -18,6 +18,7 @@ #include <limits.h> #include <arpa/inet.h> +#include <netinet/in.h> #include "netifd.h" #include "device.h" @@ -1027,7 +1028,7 @@ interface_add_dns_search_list(struct interface_ip_settings *ip, struct blob_attr } static void -write_resolv_conf_entries(FILE *f, struct interface_ip_settings *ip) +write_resolv_conf_entries(FILE *f, struct interface_ip_settings *ip, const char *dev) { struct dns_server *s; struct dns_search_domain *d; @@ -1039,7 +1040,10 @@ write_resolv_conf_entries(FILE *f, struct interface_ip_settings *ip) if (!str) continue; - fprintf(f, "nameserver %s\n", str); + if (s->af == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&s->addr)) + fprintf(f, "nameserver %s%%%s\n", str, dev); + else + fprintf(f, "nameserver %s\n", str); } vlist_simple_for_each_element(&ip->dns_search, d, node) { @@ -1074,9 +1078,9 @@ interface_write_resolv_conf(void) continue; fprintf(f, "# Interface %s\n", iface->name); - write_resolv_conf_entries(f, &iface->config_ip); + write_resolv_conf_entries(f, &iface->config_ip, iface->ifname); if (!iface->proto_ip.no_dns) - write_resolv_conf_entries(f, &iface->proto_ip); + write_resolv_conf_entries(f, &iface->proto_ip, iface->ifname); } fflush(f); rewind(f); |