resolved: choose correct file descriptor for proxy stub replies
authorBenjamin Franzke <benjaminfranzke@googlemail.com>
Wed, 1 Jun 2022 12:40:51 +0000 (14:40 +0200)
committerBenjamin Franzke <benjaminfranzke@googlemail.com>
Wed, 1 Jun 2022 13:08:33 +0000 (15:08 +0200)
commitde777ffae8683526d089a781a498af06f8c0aee7
tree7d16dcc8fe5329de9e879e688640d8c75b9792c3
parentdfa14e2859418593b2f9bfae8936d780148c4e6a
resolved: choose correct file descriptor for proxy stub replies

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