Add --no-dhcpv4-interface and --no-dhcpv6-interface options.

This commit is contained in:
Simon Kelley
2023-04-12 22:55:14 +01:00
parent 597378cdf5
commit aaba66efbd
10 changed files with 51 additions and 15 deletions

View File

@@ -244,7 +244,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
int loopback;
struct ifreq ifr;
int tftp_ok = !!option_bool(OPT_TFTP);
int dhcp_ok = 1;
int dhcp4_ok = 1;
int dhcp6_ok = 1;
int auth_dns = 0;
int is_label = 0;
#if defined(HAVE_DHCP) || defined(HAVE_TFTP)
@@ -260,7 +261,7 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
loopback = ifr.ifr_flags & IFF_LOOPBACK;
if (loopback)
dhcp_ok = 0;
dhcp4_ok = dhcp6_ok = 0;
if (!label)
label = ifr.ifr_name;
@@ -532,14 +533,17 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
if (auth_dns)
{
tftp_ok = 0;
dhcp_ok = 0;
dhcp4_ok = dhcp6_ok = 0;
}
else
for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
if (tmp->name && wildcard_match(tmp->name, ifr.ifr_name))
{
tftp_ok = 0;
dhcp_ok = 0;
if (tmp->flags & INAME_4)
dhcp4_ok = 0;
if (tmp->flags & INAME_6)
dhcp6_ok = 0;
}
#endif
@@ -566,7 +570,8 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label,
iface->addr = *addr;
iface->netmask = netmask;
iface->tftp_ok = tftp_ok;
iface->dhcp_ok = dhcp_ok;
iface->dhcp4_ok = dhcp4_ok;
iface->dhcp6_ok = dhcp6_ok;
iface->dns_auth = auth_dns;
iface->mtu = mtu;
iface->dad = !!(iface_flags & IFACE_TENTATIVE);
@@ -1295,7 +1300,7 @@ void join_multicast(int dienow)
struct irec *iface, *tmp;
for (iface = daemon->interfaces; iface; iface = iface->next)
if (iface->addr.sa.sa_family == AF_INET6 && iface->dhcp_ok && !iface->multicast_done)
if (iface->addr.sa.sa_family == AF_INET6 && iface->dhcp6_ok && !iface->multicast_done)
{
/* There's an irec per address but we only want to join for multicast
once per interface. Weed out duplicates. */