daemon: fixed issue in dhcp server subnet line using wrong address

This commit is contained in:
Blake Harnden 2021-04-23 14:00:05 -07:00
parent dcf402ae04
commit 4830538053
2 changed files with 12 additions and 16 deletions

View file

@ -248,15 +248,11 @@ ddns-update-style none;
"""
if ip.size == 1:
return ""
address = str(ip.ip)
if netaddr.valid_ipv6(address):
return ""
else:
# divide the address space in half
index = (ip.size - 2) / 2
rangelow = ip[index]
rangehigh = ip[-2]
return """
# divide the address space in half
index = (ip.size - 2) / 2
rangelow = ip[index]
rangehigh = ip[-2]
return """
subnet %s netmask %s {
pool {
range %s %s;
@ -265,12 +261,12 @@ subnet %s netmask %s {
}
}
""" % (
ip.ip,
ip.netmask,
rangelow,
rangehigh,
address,
)
ip.cidr.ip,
ip.netmask,
rangelow,
rangehigh,
ip.ip,
)
class DhcpClientService(UtilService):