diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-09-18 21:27:47 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-09-18 21:27:47 +0200 |
commit | a4440bd589db645eb99f343a8163e188a700774c (patch) | |
tree | d9e8adf0ac81eff848a62cabd457714c5f68dfdf /data/templates/dhcp-server | |
parent | 0ef9c351598d4182da267e802010aa6ce0d9c6aa (diff) | |
download | vyos-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 'data/templates/dhcp-server')
-rw-r--r-- | data/templates/dhcp-server/dhcpd.conf.tmpl | 10 |
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 f0bfa468c..3ac92d3c9 100644 --- a/data/templates/dhcp-server/dhcpd.conf.tmpl +++ b/data/templates/dhcp-server/dhcpd.conf.tmpl @@ -110,9 +110,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 %} |