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:
5
dhcpv6.c
5
dhcpv6.c
@@ -379,7 +379,7 @@ static size_t dhcpv6_dns_fill(const struct ctx *c, char *buf, int offset)
|
||||
if (c->no_dhcp_dns)
|
||||
goto search;
|
||||
|
||||
for (i = 0; !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_send[i]); i++) {
|
||||
for (i = 0; !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns[i]); i++) {
|
||||
if (!i) {
|
||||
srv = (struct opt_dns_servers *)(buf + offset);
|
||||
offset += sizeof(struct opt_hdr);
|
||||
@@ -387,8 +387,7 @@ static size_t dhcpv6_dns_fill(const struct ctx *c, char *buf, int offset)
|
||||
srv->hdr.l = 0;
|
||||
}
|
||||
|
||||
memcpy(&srv->addr[i], &c->ip6.dns_send[i],
|
||||
sizeof(srv->addr[i]));
|
||||
memcpy(&srv->addr[i], &c->ip6.dns[i], sizeof(srv->addr[i]));
|
||||
srv->hdr.l += sizeof(srv->addr[i]);
|
||||
offset += sizeof(srv->addr[i]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user