diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-11-02 23:52:38 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-11-04 12:04:32 +0100 |
commit | 73f50a76aac20a9c2fda67c5eba25661e2ebb119 (patch) | |
tree | 2d3302665ae733018f6c9f7fd1c01af832a2c227 /passt.h | |
parent | 7656a6f8888237b9e23d63666e921528b6aaf950 (diff) | |
download | passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar.gz passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar.bz2 passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar.lz passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar.xz passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.tar.zst passt-73f50a76aac20a9c2fda67c5eba25661e2ebb119.zip |
conf: Split the notions of read DNS addresses and offered ones
With --dns-forward, if the host has a loopback address configured as
DNS server, we should actually use it to forward queries, but, if
--no-map-gw is passed, we shouldn't offer the same address via DHCP,
NDP and DHCPv6, because it's not going to be reachable.
Problematic configuration:
* systemd-resolved configuring the usual 127.0.0.53 on the host: we
read that from /etc/resolv.conf
* --dns-forward specified with an unrelated address, for example
198.51.100.1
We still want to forward queries to 127.0.0.53, if we receive one
directed to 198.51.100.1, so we can't drop 127.0.0.53 from our list:
we want to use it for forwarding. At the same time, we shouldn't
offer 127.0.0.53 to the guest or container either.
With this change, I'm only covering the case of automatically
configured DNS servers from /etc/resolv.conf. We could extend this to
addresses configured with command-line options, but I don't really
see a likely use case at this point.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.h')
-rw-r--r-- | passt.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -101,7 +101,8 @@ enum passt_modes { * @addr_seen: Latest IPv4 address seen as source from tap * @prefixlen: IPv4 prefix length (netmask) * @gw: Default IPv4 gateway, network order - * @dns: IPv4 DNS addresses, zero-terminated, network order + * @dns: Host IPv4 DNS addresses, zero-terminated, network order + * @dns_send: Offered IPv4 DNS, zero-terminated, network order * @dns_fwd: Address forwarded (UDP) to first IPv4 DNS, network order */ struct ip4_ctx { @@ -110,6 +111,7 @@ struct ip4_ctx { int prefix_len; struct in_addr gw; struct in_addr dns[MAXNS + 1]; + struct in_addr dns_send[MAXNS + 1]; struct in_addr dns_fwd; }; @@ -120,7 +122,8 @@ struct ip4_ctx { * @addr_seen: Latest IPv6 global/site address seen as source from tap * @addr_ll_seen: Latest IPv6 link-local address seen as source from tap * @gw: Default IPv6 gateway - * @dns: IPv6 DNS addresses, zero-terminated + * @dns: Host IPv6 DNS addresses, zero-terminated + * @dns_send: Offered IPv6 DNS addresses, zero-terminated * @dns_fwd: Address forwarded (UDP) to first IPv6 DNS, network order */ struct ip6_ctx { @@ -130,6 +133,7 @@ struct ip6_ctx { struct in6_addr addr_ll_seen; struct in6_addr gw; struct in6_addr dns[MAXNS + 1]; + struct in6_addr dns_send[MAXNS + 1]; struct in6_addr dns_fwd; }; |