diff options
-rw-r--r-- | data/templates/l2tp/l2tp.config.tmpl | 9 | ||||
-rw-r--r-- | interface-definitions/vpn-l2tp.xml.in | 32 | ||||
-rwxr-xr-x | src/conf_mode/vpn_l2tp.py | 10 | ||||
-rwxr-xr-x | src/migration-scripts/l2tp/2-to-3 | 11 |
4 files changed, 30 insertions, 32 deletions
diff --git a/data/templates/l2tp/l2tp.config.tmpl b/data/templates/l2tp/l2tp.config.tmpl index bea2943d2..7e15233bb 100644 --- a/data/templates/l2tp/l2tp.config.tmpl +++ b/data/templates/l2tp/l2tp.config.tmpl @@ -39,13 +39,10 @@ dns{{ loop.index }}={{ dns }} {% if wins %} [wins] -{% if wins[0] %} -wins1={{wins[0]}} -{% endif %} -{% if wins[1] %} -wins2={{wins[1]}} +{% for server in wins -%} +wins{{ loop.index }}={{ server }} +{% endfor -%} {% endif %} -{% endif -%} [l2tp] verbose=1 diff --git a/interface-definitions/vpn-l2tp.xml.in b/interface-definitions/vpn-l2tp.xml.in index 0bd592746..5604ea3d2 100644 --- a/interface-definitions/vpn-l2tp.xml.in +++ b/interface-definitions/vpn-l2tp.xml.in @@ -182,29 +182,19 @@ </leafNode> </children> </node> - <node name="wins-servers"> + <leafNode name="wins-server"> <properties> - <help>Windows Internet Name Service (WINS) server settings</help> + <help>Windows Internet Name Service (WINS) servers propagated to client</help> + <valueHelp> + <format>ipv4</format> + <description>Domain Name Server (DNS) IPv4 address</description> + </valueHelp> + <constraint> + <validator name="ipv4-address"/> + </constraint> + <multi/> </properties> - <children> - <leafNode name="server-1"> - <properties> - <help>Primary WINS server</help> - <constraint> - <validator name="ipv4-address"/> - </constraint> - </properties> - </leafNode> - <leafNode name="server-2"> - <properties> - <help>Secondary WINS server</help> - <constraint> - <validator name="ipv4-address"/> - </constraint> - </properties> - </leafNode> - </children> - </node> + </leafNode> <node name="client-ip-pool"> <properties> <help>Pool of client IP addresses (must be within a /24)</help> diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py index 93ee9edf9..fb7297928 100755 --- a/src/conf_mode/vpn_l2tp.py +++ b/src/conf_mode/vpn_l2tp.py @@ -106,11 +106,8 @@ def get_config(): else: config_data['dnsv6'].append(name_server) - if c.exists('wins-servers server-1'): - config_data['wins'].append(c.return_value('wins-servers server-1')) - - if c.exists('wins-servers server-2'): - config_data['wins'].append(c.return_value('wins-servers server-2')) + if c.exists(['wins-server']): + config_data['wins'] = c.return_values(['wins-server']) if c.exists('outside-address'): config_data['outside_addr'] = c.return_value('outside-address') @@ -326,6 +323,9 @@ def verify(c): raise ConfigError( "\"set vpn l2tp remote-access client-ipv6-pool prefix\" required for delegate-prefix ") + if len(c['wins']) > 2: + raise ConfigError('Not more then two IPv4 WINS name-servers can be configured') + if len(c['dnsv4']) > 2: raise ConfigError('Not more then two IPv4 DNS name-servers can be configured') diff --git a/src/migration-scripts/l2tp/2-to-3 b/src/migration-scripts/l2tp/2-to-3 index ebeb814c1..f1f9b67b5 100755 --- a/src/migration-scripts/l2tp/2-to-3 +++ b/src/migration-scripts/l2tp/2-to-3 @@ -56,6 +56,17 @@ else: config.delete(dns_base) + + # Migrate IPv4 WINS servers + wins_base = base + ['wins-servers'] + if config.exists(wins_base): + for server in ['server-1', 'server-2']: + if config.exists(wins_base + [server]): + wins = config.return_value(wins_base + [server]) + config.set(base + ['wins-server'], value=wins, replace=False) + + config.delete(wins_base) + try: with open(file_name, 'w') as f: f.write(config.to_string()) |