summaryrefslogtreecommitdiff
path: root/data/templates/openvpn/server.conf.tmpl
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-02-09 16:07:55 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-02-09 16:07:55 +0000
commit230ac0a202acd7ae9ad9bccb9e777ee5a0e0b7b7 (patch)
treeb45a9b24b849a3b43879bd348ee1ac01ab954000 /data/templates/openvpn/server.conf.tmpl
parent9910020ae6ef37964c97bb28b6b1d84f8227650b (diff)
downloadvyos-1x-230ac0a202acd7ae9ad9bccb9e777ee5a0e0b7b7.tar.gz
vyos-1x-230ac0a202acd7ae9ad9bccb9e777ee5a0e0b7b7.zip
openvpn: T3686: Fix for check local-address in script and tmpl
Local-address should be checked/executed only if it exists in the openvpn configuration, dictionary, jinja2 template
Diffstat (limited to 'data/templates/openvpn/server.conf.tmpl')
-rw-r--r--data/templates/openvpn/server.conf.tmpl10
1 files changed, 6 insertions, 4 deletions
diff --git a/data/templates/openvpn/server.conf.tmpl b/data/templates/openvpn/server.conf.tmpl
index 7a0470d0e..fb7ad9e16 100644
--- a/data/templates/openvpn/server.conf.tmpl
+++ b/data/templates/openvpn/server.conf.tmpl
@@ -141,11 +141,13 @@ ping {{ keep_alive.interval }}
ping-restart {{ keep_alive.failure_count }}
{% if device_type == 'tap' %}
-{% for laddr, laddr_conf in local_address.items() if laddr | is_ipv4 %}
-{% if laddr_conf is defined and laddr_conf.subnet_mask is defined and laddr_conf.subnet_mask is not none %}
+{% if local_address is defined and local_address is not none %}
+{% for laddr, laddr_conf in local_address.items() if laddr | is_ipv4 %}
+{% if laddr_conf is defined and laddr_conf.subnet_mask is defined and laddr_conf.subnet_mask is not none %}
ifconfig {{ laddr }} {{ laddr_conf.subnet_mask }}
-{% endif %}
-{% endfor %}
+{% endif %}
+{% endfor %}
+{% endif %}
{% else %}
{% for laddr in local_address if laddr | is_ipv4 %}
{% for raddr in remote_address if raddr | is_ipv4 %}