udp: Actually use host resolver to forward DNS queries
Instead of the address of the first resolver we advertise to the guest or namespace. This was one of the intentions behind commit3a2afde87d
("conf, udp: Drop mostly duplicated dns_send arrays, rename related fields"), but I forgot to implement this part. In practice, they are usually the same thing, unless /etc/resolv.conf points to a loopback address. Fixes:3a2afde87d
("conf, udp: Drop mostly duplicated dns_send arrays, rename related fields") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
4ddbcb9c0c
commit
ddf7097a71
1 changed files with 2 additions and 2 deletions
4
udp.c
4
udp.c
|
@ -867,7 +867,7 @@ int udp_tap_handler(struct ctx *c, int af, const void *addr,
|
||||||
} else if (IN4_ARE_ADDR_EQUAL(&s_in.sin_addr,
|
} else if (IN4_ARE_ADDR_EQUAL(&s_in.sin_addr,
|
||||||
&c->ip4.dns_match) &&
|
&c->ip4.dns_match) &&
|
||||||
ntohs(s_in.sin_port) == 53) {
|
ntohs(s_in.sin_port) == 53) {
|
||||||
s_in.sin_addr = c->ip4.dns[0];
|
s_in.sin_addr = c->ip4.dns_host;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s_in6 = (struct sockaddr_in6) {
|
s_in6 = (struct sockaddr_in6) {
|
||||||
|
@ -890,7 +890,7 @@ int udp_tap_handler(struct ctx *c, int af, const void *addr,
|
||||||
s_in6.sin6_addr = c->ip6.addr_seen;
|
s_in6.sin6_addr = c->ip6.addr_seen;
|
||||||
} else if (IN6_ARE_ADDR_EQUAL(addr, &c->ip6.dns_match) &&
|
} else if (IN6_ARE_ADDR_EQUAL(addr, &c->ip6.dns_match) &&
|
||||||
ntohs(s_in6.sin6_port) == 53) {
|
ntohs(s_in6.sin6_port) == 53) {
|
||||||
s_in6.sin6_addr = c->ip6.dns[0];
|
s_in6.sin6_addr = c->ip6.dns_host;
|
||||||
} else if (IN6_IS_ADDR_LINKLOCAL(&s_in6.sin6_addr)) {
|
} else if (IN6_IS_ADDR_LINKLOCAL(&s_in6.sin6_addr)) {
|
||||||
bind_addr = &c->ip6.addr_ll;
|
bind_addr = &c->ip6.addr_ll;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue