daemon: fixed issue with dhcp service and dealing with addresses with a prefix of 32

This commit is contained in:
Blake Harnden 2021-04-22 23:02:42 -07:00
parent 7938379e6d
commit dcf402ae04
2 changed files with 5 additions and 1 deletions

View file

@ -149,6 +149,8 @@ class DhcpService(ConfigService):
subnets = []
for iface in self.node.get_ifaces(control=False):
for ip4 in iface.ip4s:
if ip4.size == 1:
continue
# divide the address space in half
index = (ip4.size - 2) / 2
rangelow = ip4[index]

View file

@ -236,7 +236,7 @@ max-lease-time 7200;
ddns-update-style none;
"""
for iface in node.get_ifaces(control=False):
cfg += "\n".join(map(cls.subnetentry, iface.ips()))
cfg += "\n".join(map(cls.subnetentry, iface.ip4s))
cfg += "\n"
return cfg
@ -246,6 +246,8 @@ ddns-update-style none;
Generate a subnet declaration block given an IPv4 prefix string
for inclusion in the dhcpd3 config file.
"""
if ip.size == 1:
return ""
address = str(ip.ip)
if netaddr.valid_ipv6(address):
return ""