]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: add extra check for family when doing LLMNR TCP connections
authorLennart Poettering <lennart@poettering.net>
Fri, 21 Aug 2015 20:51:05 +0000 (22:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 Aug 2015 20:51:05 +0000 (22:51 +0200)
It shouldn't happen that we try to resolve IPv4 addresses via LLMNR on
IPv6 and vice versa, but let's explicitly verify that we don't turn an
IPv4 LLMNR lookup into an IPv6 TCP connection.

src/resolve/resolved-dns-transaction.c

index 73bfbb7ed4c4860401a607466980598a8e0f3609..3fc40639179e17d8099db6d479bfafd8f6e80fa8 100644 (file)
@@ -271,6 +271,8 @@ static int dns_transaction_open_tcp(DnsTransaction *t) {
                                 return r;
                         if (r == 0)
                                 return -EINVAL;
+                        if (family != t->scope->family)
+                                return -EAFNOSUPPORT;
 
                         fd = dns_scope_tcp_socket(t->scope, family, &address, LLMNR_PORT, NULL);
                 }