From 6e08f7277f5d0be867645640bacd3f3df18faef6 Mon Sep 17 00:00:00 2001 From: LIN SE Date: Wed, 17 Jun 2020 04:44:14 +0200 Subject: [PATCH] fix handling wan with added subnets --- install.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/install.py b/install.py index 09798ef..4f5dda4 100755 --- a/install.py +++ b/install.py @@ -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: - adr, mask = subnet.split('/') + 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: