aboutgitcodebugslistschat
path: root/passt.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-02-18 04:03:53 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-02-21 13:41:13 +0100
commit89678c515755403277938e34984f3faf4863d593 (patch)
tree2e704fe4f036cc017e27be5103098b70e4954c75 /passt.h
parent01ae772dcc4ba7930179521bb22712bb4256bb03 (diff)
downloadpasst-89678c515755403277938e34984f3faf4863d593.tar
passt-89678c515755403277938e34984f3faf4863d593.tar.gz
passt-89678c515755403277938e34984f3faf4863d593.tar.bz2
passt-89678c515755403277938e34984f3faf4863d593.tar.lz
passt-89678c515755403277938e34984f3faf4863d593.tar.xz
passt-89678c515755403277938e34984f3faf4863d593.tar.zst
passt-89678c515755403277938e34984f3faf4863d593.zip
conf, udp: Introduce basic DNS forwarding
For compatibility with libslirp/slirp4netns users: introduce a mechanism to map, in the UDP routines, an address facing guest or namespace to the first IPv4 or IPv6 address resulting from configuration as resolver. This can be enabled with the new --dns-forward option. This implies that sourcing and using DNS addresses and search lists, passed via command line or read from /etc/resolv.conf, is not bound anymore to DHCP/DHCPv6/NDP usage: for example, pasta users might just want to use addresses from /etc/resolv.conf as mapping target, while not passing DNS options via DHCP. Reflect this in all the involved code paths by differentiating DHCP/DHCPv6/NDP usage from DNS configuration per se, and in the new options --dhcp-dns, --dhcp-search for pasta, and --no-dhcp-dns, --no-dhcp-search for passt. This should be the last bit to enable substantial compatibility between slirp4netns.sh and slirp4netns(1): pass the --dns-forward option from the script too. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.h')
-rw-r--r--passt.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/passt.h b/passt.h
index d7011da..2589ee7 100644
--- a/passt.h
+++ b/passt.h
@@ -114,6 +114,7 @@ enum passt_modes {
* @mask4: IPv4 netmask, network order
* @gw4: Default IPv4 gateway, network order
* @dns4: IPv4 DNS addresses, zero-terminated, network order
+ * @dns4_fwd: Address forwarded (UDP) to first IPv4 DNS, network order
* @dns_search: DNS search list
* @v6: Enable IPv6 transport
* @addr6: IPv6 address for external, routable interface
@@ -121,7 +122,8 @@ enum passt_modes {
* @addr6_seen: Latest IPv6 global/site address seen as source from tap
* @addr6_ll_seen: Latest IPv6 link-local address seen as source from tap
* @gw6: Default IPv6 gateway
- * @dns4: IPv4 DNS addresses, zero-terminated
+ * @dns6: IPv6 DNS addresses, zero-terminated
+ * @dns6_fwd: Address forwarded (UDP) to first IPv6 DNS, network order
* @ifi: Index of routable interface
* @pasta_ifn: Name of namespace interface for pasta
* @pasta_ifn: Index of namespace interface for pasta
@@ -133,8 +135,10 @@ enum passt_modes {
* @no_icmp: Disable ICMP operation
* @icmp: Context for ICMP protocol handler
* @mtu: MTU passed via DHCP/NDP
- * @no_dns: Do not assign any DNS server via DHCP/DHCPv6/NDP
- * @no_dns_search: Do not assign any DNS domain search via DHCP/DHCPv6/NDP
+ * @no_dns: Do not source/use DNS servers for any purpose
+ * @no_dns_search: Do not source/use domain search lists for any purpose
+ * @no_dhcp_dns: Do not assign any DNS server via DHCP/DHCPv6/NDP
+ * @no_dhcp_dns_search: Do not assign any DNS domain search via DHCP/DHCPv6/NDP
* @no_dhcp: Disable DHCP server
* @no_dhcpv6: Disable DHCPv6 server
* @no_ndp: Disable NDP handler altogether
@@ -172,6 +176,7 @@ struct ctx {
uint32_t mask4;
uint32_t gw4;
uint32_t dns4[MAXNS + 1];
+ uint32_t dns4_fwd;
struct fqdn dns_search[MAXDNSRCH];
@@ -182,6 +187,7 @@ struct ctx {
struct in6_addr addr6_ll_seen;
struct in6_addr gw6;
struct in6_addr dns6[MAXNS + 1];
+ struct in6_addr dns6_fwd;
unsigned int ifi;
char pasta_ifn[IF_NAMESIZE];
@@ -198,6 +204,8 @@ struct ctx {
int mtu;
int no_dns;
int no_dns_search;
+ int no_dhcp_dns;
+ int no_dhcp_dns_search;
int no_dhcp;
int no_dhcpv6;
int no_ndp;