fix handling wan with added subnets

This commit is contained in:
2020-06-17 04:44:14 +02:00
parent 8dc20ba2d5
commit 6e08f7277f

View File

@ -206,8 +206,8 @@ def create_if(name, cfg, mac, dhcp_server_cfg):
dhcp_server_cfg.append(('0.0.0.0/128.0.0.0', []))
dhcp_server_cfg.append(('128.0.0.0/192.0.0.0', []))
for nw in cfg.split(',')[1:]:
nw = IPv4Interface(cfg).network
dhcp_server_cfg.append((nw.with_netmask.split('/'), []))
nw = IPv4Interface(nw).network
dhcp_server_cfg.append((nw.with_netmask, []))
else:
cfgip = IPv4Interface(cfg)
network = cfgip.network
@ -365,7 +365,11 @@ def handle_config():
if dhcp_server_cfg:
content = [DHCP_HEADER]
for subnet, rangelist in dhcp_server_cfg:
try:
adr, mask = subnet.split('/')
except Exception as e:
print(subnet, repr(e))
continue
content.append('subnet %s netmask %s {\n' % (adr, mask))
#content.append(' option netmask %s;\n' % mask)
for rng in rangelist: