diff options
| author | Andras Elso <elso.andras@gmail.com> | 2020-03-03 01:38:03 +0100 | 
|---|---|---|
| committer | Andras Elso <elso.andras@gmail.com> | 2020-03-03 01:38:37 +0100 | 
| commit | 659ad40dbdb8f6729b6c8d9eb9e4fe333141d97b (patch) | |
| tree | ff5e50f420105b61923dd53cf81a6dfc248b5cf9 /src | |
| parent | d4fbfa57001d42144a6fde0db96a36ce21f388bf (diff) | |
| download | vyos-1x-659ad40dbdb8f6729b6c8d9eb9e4fe333141d97b.tar.gz vyos-1x-659ad40dbdb8f6729b6c8d9eb9e4fe333141d97b.zip | |
dhcp-server: T2062: Fix static route bytes
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/dhcp_server.py | 15 | 
1 files changed, 6 insertions, 9 deletions
| diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py index bf86e484b..0c7990105 100755 --- a/src/conf_mode/dhcp_server.py +++ b/src/conf_mode/dhcp_server.py @@ -594,17 +594,14 @@ def get_config():                          # add netmask                          string = str(net.prefixlen) + ','                          # add network bytes -                        bytes = str(net.network_address).split('.') -                        for b in bytes: -                            if b != '0': -                                string += b + ',' +                        if net.prefixlen: +                            width = net.prefixlen // 8 +                            if net.prefixlen % 8: +                                width += 1 +                            string += ','.join(map(str,tuple(net.network_address.packed)[:width])) + ','                          # add router bytes -                        bytes = subnet['static_router'].split('.') -                        for b in bytes: -                            string += b -                            if b is not bytes[-1]: -                                string += ',' +                        string += ','.join(subnet['static_router'].split('.'))                          subnet['static_route'] = string | 
