diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-04 23:08:03 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-04 23:08:03 +0200 |
commit | 19b50b5ba7ee8c1bfb330377309e4bab7a7531d8 (patch) | |
tree | 07291bc727cc5d50fa04dcf0d1d79112e3ac8539 /src/resolve/resolved-link.c | |
parent | b3df0b34c14ffdaf8f2d72c08ff59da14cd6f7d7 (diff) | |
download | systemd-19b50b5ba7ee8c1bfb330377309e4bab7a7531d8.tar.gz |
resolved: read the per-interface LLMNR setting from networkd and act on it
Diffstat (limited to 'src/resolve/resolved-link.c')
-rw-r--r-- | src/resolve/resolved-link.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index 2c02f09473..e1cdd6091d 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -42,6 +42,7 @@ int link_new(Manager *m, Link **ret, int ifindex) { return -ENOMEM; l->ifindex = ifindex; + l->llmnr_support = SUPPORT_YES; r = hashmap_put(m->links, INT_TO_PTR(ifindex), l); if (r < 0) @@ -92,7 +93,7 @@ static void link_allocate_scopes(Link *l) { } else l->unicast_scope = dns_scope_free(l->unicast_scope); - if (link_relevant(l, AF_INET) && l->manager->llmnr_support != SUPPORT_NO) { + if (link_relevant(l, AF_INET) && l->llmnr_support != SUPPORT_NO && l->manager->llmnr_support != SUPPORT_NO) { if (!l->llmnr_ipv4_scope) { r = dns_scope_new(l->manager, &l->llmnr_ipv4_scope, l, DNS_PROTOCOL_LLMNR, AF_INET); if (r < 0) @@ -101,7 +102,7 @@ static void link_allocate_scopes(Link *l) { } else l->llmnr_ipv4_scope = dns_scope_free(l->llmnr_ipv4_scope); - if (link_relevant(l, AF_INET6) && l->manager->llmnr_support != SUPPORT_NO) { + if (link_relevant(l, AF_INET6) && l->llmnr_support != SUPPORT_NO && l->manager->llmnr_support != SUPPORT_NO) { if (!l->llmnr_ipv6_scope) { r = dns_scope_new(l->manager, &l->llmnr_ipv6_scope, l, DNS_PROTOCOL_LLMNR, AF_INET6); if (r < 0) @@ -188,10 +189,40 @@ clear: return r; } +static int link_update_llmnr_support(Link *l) { + _cleanup_free_ char *b = NULL; + int r; + + assert(l); + + r = sd_network_get_llmnr(l->ifindex, &b); + if (r < 0) + goto clear; + + r = parse_boolean(b); + if (r < 0) { + if (streq(b, "resolve")) + l->llmnr_support = SUPPORT_RESOLVE; + else + goto clear; + + } else if (r > 0) + l->llmnr_support = SUPPORT_YES; + else + l->llmnr_support = SUPPORT_NO; + + return 0; + +clear: + l->llmnr_support = SUPPORT_YES; + return r; +} + int link_update_monitor(Link *l) { assert(l); link_update_dns_servers(l); + link_update_llmnr_support(l); link_allocate_scopes(l); link_add_rrs(l, false); @@ -353,6 +384,7 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) { if (!force_remove && link_address_relevant(a) && a->link->llmnr_ipv4_scope && + a->link->llmnr_support == SUPPORT_YES && a->link->manager->llmnr_support == SUPPORT_YES) { if (!a->link->manager->host_ipv4_key) { @@ -409,6 +441,7 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) { if (!force_remove && link_address_relevant(a) && a->link->llmnr_ipv6_scope && + a->link->llmnr_support == SUPPORT_YES && a->link->manager->llmnr_support == SUPPORT_YES) { if (!a->link->manager->host_ipv6_key) { |