1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-18 05:05:33 +02:00

conf, udp: Drop mostly duplicated dns_send arrays, rename related fields

Given that we use just the first valid DNS resolver address
configured, or read from resolv.conf(5) on the host, to forward DNS
queries to, in case --dns-forward is used, we don't need to duplicate
dns[] to dns_send[]:

- rename dns_send[] back to dns[]: those are the resolvers we
  advertise to the guest/container

- for forwarding purposes, instead of dns[], use a single field (for
  each protocol version): dns_host

- and rename dns_fwd to dns_match, so that it's clear this is the
  address we are matching DNS queries against, to decide if they need
  to be forwarded

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2022-11-10 20:30:03 +01:00
parent 4129764eca
commit 3a2afde87d
6 changed files with 62 additions and 71 deletions

5
dhcp.c
View file

@ -359,9 +359,8 @@ int dhcp(const struct ctx *c, const struct pool *p)
}
for (i = 0, opts[6].slen = 0;
!c->no_dhcp_dns && !IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns_send[i]);
i++) {
((struct in_addr *)opts[6].s)[i] = c->ip4.dns_send[i];
!c->no_dhcp_dns && !IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns[i]); i++) {
((struct in_addr *)opts[6].s)[i] = c->ip4.dns[i];
opts[6].slen += sizeof(uint32_t);
}