From a533ca621567150732b58fc5176cd18b608f1f92 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 10 Apr 2020 19:43:38 +0200 Subject: vpn: l2tp: T2264: combine WINS CLI syntax There is no reason to distinguish between WINS servers in terms of priority. This is solely a task which can be done in the underlaying Python scripts. --- src/conf_mode/vpn_l2tp.py | 10 +++++----- src/migration-scripts/l2tp/2-to-3 | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') 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()) -- cgit v1.2.3