summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-10 18:46:35 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-11 11:25:13 +0200
commit3217abf039388465558c8cf8a6d29dda2c58189d (patch)
tree2b4000ee64bf047a06fd1866eecebd96205be1f0 /src
parent5a1a4bb5ac2de027ced721bdf82021f5424e0bee (diff)
downloadvyos-1x-3217abf039388465558c8cf8a6d29dda2c58189d.tar.gz
vyos-1x-3217abf039388465558c8cf8a6d29dda2c58189d.zip
vpn: l2tp: T2264: use default_config_data dict
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vpn_l2tp.py52
1 files changed, 27 insertions, 25 deletions
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'):