1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-08 08:35:35 +02:00

dhcp, ndp, dhcpv6: Support for multiple DNS servers, search list

Add support for a variable amount of DNS servers, including zero,
from /etc/resolv.conf, in DHCP, NDP and DHCPv6 implementations.

Introduce support for domain search list for DHCP (RFC 3397),
NDP (RFC 8106), and DHCPv6 (RFC 3646), also sourced from
/etc/resolv.conf.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-05-21 11:14:47 +02:00
parent 0231ac1c86
commit 9010054ea4
6 changed files with 312 additions and 45 deletions

17
passt.h
View file

@ -20,6 +20,12 @@ struct tap_msg {
#include "tcp.h"
#include "udp.h"
#include <resolv.h> /* For MAXNS below */
struct fqdn {
char n[NS_MAXDNAME];
};
/**
* struct ctx - Execution context
* @epollfd: file descriptor for epoll instance
@ -31,13 +37,14 @@ struct tap_msg {
* @addr4_seen: Latest IPv4 address seen as source from tap
* @mask4: IPv4 netmask, network order
* @gw4: Default IPv4 gateway, network order
* @dns4: IPv4 DNS address, network order
* @dns4: IPv4 DNS addresses, zero-terminated, network order
* @dns_search: DNS search list
* @v6: Enable IPv6 transport
* @addr6: IPv6 address for external, routable interface
* @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: IPv6 DNS address
* @dns4: IPv4 DNS addresses, zero-terminated
* @ifn: Name of routable interface
*/
struct ctx {
@ -51,14 +58,16 @@ struct ctx {
uint32_t addr4_seen;
uint32_t mask4;
uint32_t gw4;
uint32_t dns4;
uint32_t dns4[MAXNS + 1];
struct fqdn dns_search[MAXDNSRCH];
int v6;
struct in6_addr addr6;
struct in6_addr addr6_seen;
struct in6_addr addr6_ll_seen;
struct in6_addr gw6;
struct in6_addr dns6;
struct in6_addr dns6[MAXNS + 1];
char ifn[IF_NAMESIZE];