summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-09-18 21:27:47 +0200
committerChristian Poessinger <christian@poessinger.com>2021-09-19 12:22:10 +0200
commit482aaf1cee85487c14a183770d23ceda4611d1c6 (patch)
treeefb95efa90613002b1012bc1d2626198447b9ba2 /data
parentc4cce047d97ffdcaf9279bfffde0b4eaa9976eab (diff)
downloadvyos-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 'data')
-rw-r--r--data/templates/dhcp-server/dhcpd.conf.tmpl10
1 files changed, 7 insertions, 3 deletions
diff --git a/data/templates/dhcp-server/dhcpd.conf.tmpl b/data/templates/dhcp-server/dhcpd.conf.tmpl
index ff2e31998..58be7984d 100644
--- a/data/templates/dhcp-server/dhcpd.conf.tmpl
+++ b/data/templates/dhcp-server/dhcpd.conf.tmpl
@@ -114,9 +114,13 @@ shared-network {{ network | replace('_','-') }} {
{% if subnet_config.default_router and subnet_config.default_router is not none %}
{% set static_default_route = ', ' + '0.0.0.0/0' | isc_static_route(subnet_config.default_router) %}
{% endif %}
-{% if subnet_config.static_route.router is defined and subnet_config.static_route.router is not none and subnet_config.static_route.destination_subnet is defined and subnet_config.static_route.destination_subnet is not none %}
- option rfc3442-static-route {{ subnet_config.static_route.destination_subnet | isc_static_route(subnet_config.static_route.router) }}{{ static_default_route }};
- option windows-static-route {{ subnet_config.static_route.destination_subnet | isc_static_route(subnet_config.static_route.router) }};
+{% if subnet_config.static_route is defined and subnet_config.static_route is not none %}
+{% set rfc3442_routes = [] %}
+{% for route, route_options in subnet_config.static_route.items() %}
+{% set rfc3442_routes = rfc3442_routes.append(route | isc_static_route(route_options.next_hop)) %}
+{% endfor %}
+ option rfc3442-static-route {{ rfc3442_routes | join(', ') }}{{ static_default_route }};
+ option windows-static-route {{ rfc3442_routes | join(', ') }};
{% endif %}
{% endif %}
{% if subnet_config.ip_forwarding is defined %}