diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-10 20:30:03 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-16 15:09:31 +0100 |
commit | 3a2afde87dd15e9e9716cadaedce37de47a05d91 (patch) | |
tree | 340619abfaea041e3c0c91975615f2a996d92f22 /ndp.c | |
parent | 4129764ecaebf05a33e22d8d95bb3d8deaa14c14 (diff) | |
download | passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar.gz passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar.bz2 passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar.lz passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar.xz passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.tar.zst passt-3a2afde87dd15e9e9716cadaedce37de47a05d91.zip |
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>
Diffstat (limited to 'ndp.c')
-rw-r--r-- | ndp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -121,7 +121,7 @@ int ndp(struct ctx *c, const struct icmp6hdr *ih, const struct in6_addr *saddr) if (c->no_dhcp_dns) goto dns_done; - for (n = 0; !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_send[n]); n++); + for (n = 0; !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns[n]); n++); if (n) { *p++ = 25; /* RDNSS */ *p++ = 1 + 2 * n; /* length */ @@ -130,8 +130,8 @@ int ndp(struct ctx *c, const struct icmp6hdr *ih, const struct in6_addr *saddr) p += 4; for (i = 0; i < n; i++) { - memcpy(p, &c->ip6.dns_send[i], 16); - p += 16; /* address */ + memcpy(p, &c->ip6.dns[i], 16); /* address */ + p += 16; } for (n = 0; *c->dns_search[n].n; n++) |