daemon: fixed issue in dhcp server subnet line using wrong address
This commit is contained in:
parent
dcf402ae04
commit
4830538053
2 changed files with 12 additions and 16 deletions
|
@ -155,7 +155,7 @@ class DhcpService(ConfigService):
|
||||||
index = (ip4.size - 2) / 2
|
index = (ip4.size - 2) / 2
|
||||||
rangelow = ip4[index]
|
rangelow = ip4[index]
|
||||||
rangehigh = ip4[-2]
|
rangehigh = ip4[-2]
|
||||||
subnets.append((ip4.ip, ip4.netmask, rangelow, rangehigh, str(ip4.ip)))
|
subnets.append((ip4.cidr.ip, ip4.netmask, rangelow, rangehigh, ip4.ip))
|
||||||
return dict(subnets=subnets)
|
return dict(subnets=subnets)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -248,15 +248,11 @@ ddns-update-style none;
|
||||||
"""
|
"""
|
||||||
if ip.size == 1:
|
if ip.size == 1:
|
||||||
return ""
|
return ""
|
||||||
address = str(ip.ip)
|
# divide the address space in half
|
||||||
if netaddr.valid_ipv6(address):
|
index = (ip.size - 2) / 2
|
||||||
return ""
|
rangelow = ip[index]
|
||||||
else:
|
rangehigh = ip[-2]
|
||||||
# divide the address space in half
|
return """
|
||||||
index = (ip.size - 2) / 2
|
|
||||||
rangelow = ip[index]
|
|
||||||
rangehigh = ip[-2]
|
|
||||||
return """
|
|
||||||
subnet %s netmask %s {
|
subnet %s netmask %s {
|
||||||
pool {
|
pool {
|
||||||
range %s %s;
|
range %s %s;
|
||||||
|
@ -265,12 +261,12 @@ subnet %s netmask %s {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""" % (
|
""" % (
|
||||||
ip.ip,
|
ip.cidr.ip,
|
||||||
ip.netmask,
|
ip.netmask,
|
||||||
rangelow,
|
rangelow,
|
||||||
rangehigh,
|
rangehigh,
|
||||||
address,
|
ip.ip,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DhcpClientService(UtilService):
|
class DhcpClientService(UtilService):
|
||||||
|
|
Loading…
Add table
Reference in a new issue