From 3217abf039388465558c8cf8a6d29dda2c58189d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 10 Apr 2020 18:46:35 +0200 Subject: vpn: l2tp: T2264: use default_config_data dict --- src/conf_mode/vpn_l2tp.py | 52 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py index cb4e44443..b5ad1c3c0 100755 --- a/src/conf_mode/vpn_l2tp.py +++ b/src/conf_mode/vpn_l2tp.py @@ -17,6 +17,7 @@ import os import re +from copy import deepcopy from socket import AF_INET, SOCK_STREAM, socket from sys import exit from time import sleep @@ -39,6 +40,31 @@ l2tp_conf = l2tp_cnf_dir + '/l2tp.config' if not os.path.exists(l2tp_cnf_dir): os.makedirs(l2tp_cnf_dir) + +default_config_data = { + 'authentication': { + 'mode': 'local', + 'local-users': { + }, + 'radiussrv': {}, + 'radiusopt': {}, + 'auth_proto': [], + 'mppe': 'prefer' + }, + 'outside_addr': '', + 'gateway_address': '10.255.255.0', + 'dns': [], + 'dnsv6': [], + 'wins': [], + 'client_ip_pool': None, + 'client_ip_subnets': [], + 'client_ipv6_pool': {}, + 'mtu': '1436', + 'ip6_column': '', + 'ip6_dp_column': '', + 'ppp_options': {}, +} + ### # inline helper functions ### @@ -78,33 +104,9 @@ def get_config(): return None c.set_level(base) - - config_data = { - 'authentication': { - 'mode': 'local', - 'local-users': { - }, - 'radiussrv': {}, - 'radiusopt': {}, - 'auth_proto': [], - 'mppe': 'prefer' - }, - 'outside_addr': '', - 'gateway_address': '10.255.255.0', - 'dns': [], - 'dnsv6': [], - 'wins': [], - 'client_ip_pool': None, - 'client_ip_subnets': [], - 'client_ipv6_pool': {}, - 'mtu': '1436', - 'ip6_column': '', - 'ip6_dp_column': '', - 'ppp_options': {}, - } + config_data = deepcopy(default_config_data) ### general options ### - if c.exists('dns-servers server-1'): config_data['dns'].append(c.return_value('dns-servers server-1')) if c.exists('dns-servers server-2'): -- cgit v1.2.3