]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolved: bind socket to interface during connect()
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Nov 2020 17:22:38 +0000 (18:22 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 8 Dec 2020 17:08:31 +0000 (18:08 +0100)
commit98571eb99cc08fb1a44a8bbeac4aa6faea2107e7
tree90a37bac466f8c6dd02f672c50a78d499d5a6698
parentecac28843435eaf8c07f6e266c0d26d90a6aeee4
resolved: bind socket to interface during connect()

Apparently, IF_UNICAST_IF does not influence the routing decisions done
during connect(). But SO_BINDTODEVICE/SO_BINDTOINDEX does, which however
brings a lot of other semantics with it, we are not so interested in
(i.e. it doesn't not allow packets from any other iface to us, even if
routing otherwise allows it).

Hence, let's bind to the ifindex immediately before the connect() and
unbind right after again, so that we get the semantics we want, but not
the ones we don't.

Fixes: #11935
Replaces: #12004
(cherry picked from commit d301c52383ca7cfa6b7cda87d7a4209c234a532c)
src/resolve/resolved-dns-scope.c
src/resolve/resolved.c