summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2024-03-08 15:09:58 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2024-03-12 18:36:02 +0000
commitd56b4c05726d4f4fb4fb5128a9223df1963fbdb7 (patch)
treedbc21ceddeba57343a81b1ce52e44ba45d4a9724
parent423a25a814ca92870399dab1c5e107732a16292d (diff)
downloadvyos-1x-d56b4c05726d4f4fb4fb5128a9223df1963fbdb7.tar.gz
vyos-1x-d56b4c05726d4f4fb4fb5128a9223df1963fbdb7.zip
T6110: dhcp: add error check when fail-over is enabled on a subnet, but range is not defined.
-rwxr-xr-xsrc/conf_mode/dhcp_server.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index ff0f5ecc5..b5d4a3ade 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -174,8 +174,11 @@ def verify(dhcp):
# DHCP failover needs at least one subnet that uses it
if 'enable_failover' in subnet_config:
if 'failover' not in dhcp:
- raise ConfigError(f'Can not enable failover for "{subnet}" in "{network}".\n' \
+ raise ConfigError(f'Cannot enable failover for "{subnet}" in "{network}".\n' \
'Failover is not configured globally!')
+ if 'range' not in subnet_config:
+ raise ConfigError(f'Cannot enable failover for "{subnet}" in "{network}".\n' \
+ f'Range is not configured for "{subnet}"')
failover_ok = True
# Check if DHCP address range is inside configured subnet declaration