From de777ffae8683526d089a781a498af06f8c0aee7 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 1 Jun 2022 14:40:51 +0200 Subject: [PATCH] resolved: choose correct file descriptor for proxy stub replies MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit find_socket_fd() does not expect the sender address, but the listen-address. This is in fact the destination of the DNS packet. Matching via sender address caused a fallback to the default stub listener in manager_dns_stub_fd() as the sender address can never match the proxy stub listen address. Note that manager_dns_stub_fd() is only used for the default listener stub and the proxy stub, that means *extra* listeners stubs (DNSStubListenerExtra=…) have not been affected as `struct DnsStubListenerExtra` provides a direct link to the event source. By using the correct fd we ensure the correct socket options (like TTL) are used and prevent issues like #23495 in case ifindex could not be determined. --- src/resolve/resolved-dns-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolve/resolved-dns-stub.c b/src/resolve/resolved-dns-stub.c index 89d1f1cdfc2..fdd589fa92c 100644 --- a/src/resolve/resolved-dns-stub.c +++ b/src/resolve/resolved-dns-stub.c @@ -530,7 +530,7 @@ static int dns_stub_send( else { int fd, ifindex; - fd = find_socket_fd(m, l, p->family, &p->sender, SOCK_DGRAM); + fd = find_socket_fd(m, l, p->family, &p->destination, SOCK_DGRAM); if (fd < 0) return fd; -- 2.47.3