From c4ade6d6a9084b2861d30b674ae31589a1b88bde Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Wed, 25 Mar 2020 18:38:47 +0100 Subject: openvpn: T2148: fix setting "server client" without "ip" --- src/conf_mode/interfaces-openvpn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/conf_mode') 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): -- cgit v1.2.3