summaryrefslogtreecommitdiff
path: root/data/templates/ipsec/swanctl.conf.tmpl
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-07-18 21:35:53 +0200
committerChristian Poessinger <christian@poessinger.com>2021-07-18 21:35:53 +0200
commit48c768abbf53b752a55db2adea1f998cb28da55c (patch)
treef1f0870c19466ec128264af78701e08cea54744c /data/templates/ipsec/swanctl.conf.tmpl
parent0a9ff39b48804af541ccd00f567c54014f8e1db2 (diff)
downloadvyos-1x-48c768abbf53b752a55db2adea1f998cb28da55c.tar.gz
vyos-1x-48c768abbf53b752a55db2adea1f998cb28da55c.zip
ipsec: T1210: remote-access pools can not hold both IPv4 and IPv6 prefixes
... this enables a dual-stack IKEv2 VPN deployment.
Diffstat (limited to 'data/templates/ipsec/swanctl.conf.tmpl')
-rw-r--r--data/templates/ipsec/swanctl.conf.tmpl30
1 files changed, 24 insertions, 6 deletions
diff --git a/data/templates/ipsec/swanctl.conf.tmpl b/data/templates/ipsec/swanctl.conf.tmpl
index 102d7583f..b85fe7d41 100644
--- a/data/templates/ipsec/swanctl.conf.tmpl
+++ b/data/templates/ipsec/swanctl.conf.tmpl
@@ -28,13 +28,31 @@ connections {
pools {
{% if remote_access is defined %}
{% for ra, ra_conf in remote_access.items() if ra_conf.pool.dhcp_enable is not defined %}
- ra-{{ ra }} {
- addrs = {{ ra_conf.pool.prefix }}
- dns = {{ ra_conf.pool.name_server | join(",") }}
-{% if ra_conf.pool.exclude is defined %}
- split_exclude = {{ ra_conf.pool.exclude | join(",") }}
-{% endif %}
+{% if ra_conf.pool is defined and ra_conf.pool.prefix is defined %}
+{% for prefix in ra_conf.pool.prefix %}
+{% if prefix | is_ipv4 %}
+ ra-{{ ra }}-ipv4 {
+ addrs = {{ prefix }}
+{% if ra_conf.pool.name_server_v4 is defined and ra_conf.pool.name_server_v4 is not none %}
+ dns = {{ ra_conf.pool.name_server_v4 | join(',') }}
+{% endif %}
+{% if ra_conf.pool.exclude_v4 is defined and ra_conf.pool.exclude_v4 is not none %}
+ split_exclude = {{ ra_conf.pool.exclude_v4 | join(',') }}
+{% endif %}
+ }
+{% elif prefix | is_ipv6 %}
+ ra-{{ ra }}-ipv6 {
+ addrs = {{ prefix }}
+{% if ra_conf.pool.name_server_v6 is defined and ra_conf.pool.name_server_v6 is not none %}
+ dns = {{ ra_conf.pool.name_server_v6 | join(',') }}
+{% endif %}
+{% if ra_conf.pool.exclude_v6 is defined and ra_conf.pool.exclude_v6 is not none %}
+ split_exclude = {{ ra_conf.pool.exclude_v6 | join(',') }}
+{% endif %}
}
+{% endif %}
+{% endfor %}
+{% endif %}
{% endfor %}
{% endif %}
}