summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-18 21:27:47 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-18 21:27:47 +0200
commita4440bd589db645eb99f343a8163e188a700774c (patch)
treed9e8adf0ac81eff848a62cabd457714c5f68dfdf /src/conf_mode
parent0ef9c351598d4182da267e802010aa6ce0d9c6aa (diff)
downloadvyos-1x-a4440bd589db645eb99f343a8163e188a700774c.tar.gz
vyos-1x-a4440bd589db645eb99f343a8163e188a700774c.zip
dhcp-server: T1968: allow multiple static-routes to be configured
vyos@vyos# show service dhcp-server shared-network-name LAN { subnet 10.0.0.0/24 { default-router 10.0.0.1 dns-server 194.145.150.1 lease 88 range 0 { start 10.0.0.100 stop 10.0.0.200 } static-route 192.168.10.0/24 { next-hop 10.0.0.2 } static-route 192.168.20.0/24 { router 10.0.0.2 } } }
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/dhcp_server.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index cdee72e09..8d6cef8b7 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -159,9 +159,10 @@ def verify(dhcp):
'lease subnet must be configured.')
for subnet, subnet_config in network_config['subnet'].items():
- if 'static_route' in subnet_config and len(subnet_config['static_route']) != 2:
- raise ConfigError('Missing DHCP static-route parameter(s):\n' \
- 'destination-subnet | router must be defined!')
+ if 'static_route' in subnet_config:
+ for route, route_option in subnet_config['static_route'].items():
+ if 'next_hop' not in route_option:
+ raise ConfigError(f'DHCP static-route "{route}" requires router to be defined!')
# Check if DHCP address range is inside configured subnet declaration
if 'range' in subnet_config: