summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-19 10:11:46 +0200
committerChristian Poessinger <christian@poessinger.com>2019-10-19 10:11:48 +0200
commit735d73e162634d598aa6b8ee13197aa231eefedb (patch)
tree7c52659cc381b347a7deeaa10e1fb97b1c087549
parentf87b5fa3b9a2c1c6826701924712654c8f0c5709 (diff)
downloadvyos-1x-735d73e162634d598aa6b8ee13197aa231eefedb.tar.gz
vyos-1x-735d73e162634d598aa6b8ee13197aa231eefedb.zip
dhcp-server: T1745: bugfix corner case on static-assignments
There was a bug when refactoring this with commits 5848a4d ("dhcp-server: T1707: remove DHCP static-mappings from address pool") and 1182b44 ("dhcp-server: T1707: bugfix on subsequent DHCP exclude addresses") that when a static address assignemnt was using the last IP address from the specified range. This triggered the following error: "DHCP range stop address x must be greater or equal to the range start address y!"
-rwxr-xr-xsrc/conf_mode/dhcp_server.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index f19bcb250..af803a696 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -303,7 +303,8 @@ def dhcp_slice_range(exclude_list, range_list):
'start': str(ip_address(e) + 1),
'stop': str(range_stop)
}
- output.append(r)
+ if not (ip_address(r['start']) > ip_address(r['stop'])):
+ output.append(r)
else:
# if we have no exclude in the whole range - we just take the range
# as it is