]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved-dns-query: remove dns_query_candidate_is_routable
authorFlorian Klink <flokli@flokli.de>
Sat, 23 Nov 2019 10:45:34 +0000 (11:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 May 2020 17:30:23 +0000 (19:30 +0200)
Resolved can't reliably determine on whether "it makes sense" to query
AAAA records when not explicitly specifying it in the request, so we
shouldn't remove them.

After having done the resolving, applications can use RFC6724 to
determine whether that address is reachable.

We can't know whether an address is reachable before having resolved it
and inspecting the routing table, and not resolving AAAA just because
there's no IPv6 default route on the main interface link them breaks
various setups, including IPv6-providing wireguard tunnels on a
non-dualstacked environment.

Fixes #5782
Fixes #5915
Fixes #8017

src/resolve/resolved-dns-query.c

index 4a41921cf3f2ad66f60a21926f4d9d1621b68571..d6eca6dfdd75d1bf93901ac793e281bedff9a380 100644 (file)
@@ -212,31 +212,6 @@ static DnsTransactionState dns_query_candidate_state(DnsQueryCandidate *c) {
         return state;
 }
 
-static bool dns_query_candidate_is_routable(DnsQueryCandidate *c, uint16_t type) {
-        int family;
-
-        assert(c);
-
-        /* Checks whether the specified RR type matches an address family that is routable on the link(s) the scope of
-         * this candidate belongs to. Specifically, whether there's a routable IPv4 address on it if we query an A RR,
-         * or a routable IPv6 address if we query an AAAA RR. */
-
-        if (!c->query->suppress_unroutable_family)
-                return true;
-
-        if (c->scope->protocol != DNS_PROTOCOL_DNS)
-                return true;
-
-        family = dns_type_to_af(type);
-        if (family < 0)
-                return true;
-
-        if (c->scope->link)
-                return link_relevant(c->scope->link, family, false);
-        else
-                return manager_routable(c->scope->manager, family);
-}
-
 static int dns_query_candidate_setup_transactions(DnsQueryCandidate *c) {
         DnsQuestion *question;
         DnsResourceKey *key;
@@ -253,9 +228,6 @@ static int dns_query_candidate_setup_transactions(DnsQueryCandidate *c) {
                 _cleanup_(dns_resource_key_unrefp) DnsResourceKey *new_key = NULL;
                 DnsResourceKey *qkey;
 
-                if (!dns_query_candidate_is_routable(c, key->type))
-                        continue;
-
                 if (c->search_domain) {
                         r = dns_resource_key_new_append_suffix(&new_key, key, c->search_domain->name);
                         if (r < 0)