From 9e08a6e0ce6ae37189666fd2517e643e971e45b1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 21 Aug 2015 22:51:05 +0200 Subject: [PATCH] resolved: add extra check for family when doing LLMNR TCP connections 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 73bfbb7ed4..3fc4063917 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -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); }