mirror of
https://github.com/systemd/systemd.git
synced 2024-12-27 07:22:31 +03:00
Merge pull request #25438 from poettering/localhost-ifindex-tweak
resolved: fix ifindex for contacting per-interface DNS server if it is 127.0.0.1
This commit is contained in:
commit
da2e6df00a
@ -424,7 +424,7 @@ static int dns_scope_socket(
|
||||
return r;
|
||||
}
|
||||
|
||||
if (s->link) {
|
||||
if (ifindex != 0) {
|
||||
r = socket_set_unicast_if(fd, sa.sa.sa_family, ifindex);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -648,6 +648,11 @@ int dns_server_adjust_opt(DnsServer *server, DnsPacket *packet, DnsServerFeature
|
||||
int dns_server_ifindex(const DnsServer *s) {
|
||||
assert(s);
|
||||
|
||||
/* For loopback addresses, go via the loopback interface, regardless which interface this is linked
|
||||
* to. */
|
||||
if (in_addr_is_localhost(s->family, &s->address))
|
||||
return LOOPBACK_IFINDEX;
|
||||
|
||||
/* The link ifindex always takes precedence */
|
||||
if (s->link)
|
||||
return s->link->ifindex;
|
||||
|
Loading…
Reference in New Issue
Block a user