diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-09-18 21:27:47 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-09-19 12:22:10 +0200 |
commit | 482aaf1cee85487c14a183770d23ceda4611d1c6 (patch) | |
tree | efb95efa90613002b1012bc1d2626198447b9ba2 /src/conf_mode/dhcp_server.py | |
parent | c4cce047d97ffdcaf9279bfffde0b4eaa9976eab (diff) | |
download | vyos-1x-482aaf1cee85487c14a183770d23ceda4611d1c6.tar.gz vyos-1x-482aaf1cee85487c14a183770d23ceda4611d1c6.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
}
}
}
(cherry picked from commit a4440bd589db645eb99f343a8163e188a700774c)
Diffstat (limited to 'src/conf_mode/dhcp_server.py')
-rwxr-xr-x | src/conf_mode/dhcp_server.py | 7 |
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: |