summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-openvpn.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-25 18:47:00 +0100
committerGitHub <noreply@github.com>2020-03-25 18:47:00 +0100
commit0e4a28ca478e26632938f12e91a97b09327673e1 (patch)
treed2c21a1cf25de6e236b3bc1bdfad8c5c05f15b43 /src/conf_mode/interfaces-openvpn.py
parent11f5d7c3669e6f20b61470c439929ef410e62ff5 (diff)
parentc4ade6d6a9084b2861d30b674ae31589a1b88bde (diff)
downloadvyos-1x-0e4a28ca478e26632938f12e91a97b09327673e1.tar.gz
vyos-1x-0e4a28ca478e26632938f12e91a97b09327673e1.zip
Merge pull request #269 from jjakob/openvpn-client-ip-fix
openvpn: T2148: fix setting "server client" without "ip"
Diffstat (limited to 'src/conf_mode/interfaces-openvpn.py')
-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):