summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-03-25 18:38:47 +0100
committerJernej Jakob <jernej.jakob@gmail.com>2020-03-25 18:44:10 +0100
commitc4ade6d6a9084b2861d30b674ae31589a1b88bde (patch)
treed2c21a1cf25de6e236b3bc1bdfad8c5c05f15b43 /src
parent11f5d7c3669e6f20b61470c439929ef410e62ff5 (diff)
downloadvyos-1x-c4ade6d6a9084b2861d30b674ae31589a1b88bde.tar.gz
vyos-1x-c4ade6d6a9084b2861d30b674ae31589a1b88bde.zip
openvpn: T2148: fix setting "server client" without "ip"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-openvpn.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py
index 9313e339b..155101f1d 100755
--- a/src/conf_mode/interfaces-openvpn.py
+++ b/src/conf_mode/interfaces-openvpn.py
@@ -264,7 +264,9 @@ compat-names
client_tmpl = """
### Autogenerated by interfaces-openvpn.py ###
+{% if ip -%}
ifconfig-push {{ ip }} {{ remote_netmask }}
+{% endif -%}
{% for route in push_route -%}
push "route {{ route }}"
{% endfor -%}
@@ -273,9 +275,9 @@ push "route {{ route }}"
iroute {{ net }}
{% endfor -%}
-{%- if disable %}
+{% if disable -%}
disable
-{% endif %}
+{% endif -%}
"""
default_config_data = {
@@ -886,11 +888,9 @@ def verify(openvpn):
#
subnet = openvpn['server_subnet'].replace(' ', '/')
for client in openvpn['client']:
- if not ip_address(client['ip']) in ip_network(subnet):
+ if client['ip'] and not ip_address(client['ip']) in ip_network(subnet):
raise ConfigError('Client IP "{}" not in server subnet "{}'.format(client['ip'], subnet))
-
-
return None
def generate(openvpn):