diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-03 05:09:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 05:09:54 +0100 |
commit | 98a4a7d66a7dbfee113885a5f804e7d3f344685d (patch) | |
tree | ff5e50f420105b61923dd53cf81a6dfc248b5cf9 /src | |
parent | d4fbfa57001d42144a6fde0db96a36ce21f388bf (diff) | |
parent | 659ad40dbdb8f6729b6c8d9eb9e4fe333141d97b (diff) | |
download | vyos-1x-98a4a7d66a7dbfee113885a5f804e7d3f344685d.tar.gz vyos-1x-98a4a7d66a7dbfee113885a5f804e7d3f344685d.zip |
Merge pull request #234 from Elbandi/fix-static-route
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 |