1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-18 06:03:42 +03:00

resolved: disable SO_BINDTOIFINDEX hack for localhost IP addresses

Fixes: #23010
(cherry picked from commit 5f9041afec65ce88c8b2a2ca3f6d14802ac01a56)
(cherry picked from commit a0532ffd2f6e3f792bc77b7f74a0babb23d87ef6)
(cherry picked from commit 640acfb45907c8cea7a5b010e52b6aa23e284a2e)
This commit is contained in:
Lennart Poettering 2023-01-05 22:10:46 +01:00 committed by Luca Boccassi
parent 652c6054f1
commit 079bfa7d76

View File

@ -474,7 +474,8 @@ static int dns_scope_socket(
* host result in EHOSTUNREACH, since Linux won't send the packets out of the specified * host result in EHOSTUNREACH, since Linux won't send the packets out of the specified
* interface, but delivers them directly to the local socket. */ * interface, but delivers them directly to the local socket. */
if (s->link && if (s->link &&
!manager_find_link_address(s->manager, sa.sa.sa_family, sockaddr_in_addr(&sa.sa))) { !manager_find_link_address(s->manager, sa.sa.sa_family, sockaddr_in_addr(&sa.sa)) &&
in_addr_is_localhost(sa.sa.sa_family, sockaddr_in_addr(&sa.sa)) == 0) {
r = socket_bind_to_ifindex(fd, ifindex); r = socket_bind_to_ifindex(fd, ifindex);
if (r < 0) if (r < 0)
return r; return r;