summaryrefslogtreecommitdiff
path: root/src/conf_mode/vpn_l2tp.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-11 00:48:09 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-11 11:25:59 +0200
commit2928a338dee759d8635b87fc96abe090ebad80e5 (patch)
treebb891b1667bc5acc827b45de15b6c903d29759d2 /src/conf_mode/vpn_l2tp.py
parent20da27d779ad0d0c9bb78a0f661bc580abcf208e (diff)
downloadvyos-1x-2928a338dee759d8635b87fc96abe090ebad80e5.tar.gz
vyos-1x-2928a338dee759d8635b87fc96abe090ebad80e5.zip
vpn: l2tp: T2264: proper set PPP default values to ease Jinja2 template
Diffstat (limited to 'src/conf_mode/vpn_l2tp.py')
-rwxr-xr-xsrc/conf_mode/vpn_l2tp.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/conf_mode/vpn_l2tp.py b/src/conf_mode/vpn_l2tp.py
index 1058eeac6..bb51b4573 100755
--- a/src/conf_mode/vpn_l2tp.py
+++ b/src/conf_mode/vpn_l2tp.py
@@ -50,6 +50,9 @@ default_config_data = {
'mtu': '1436',
'outside_addr': '',
'ppp_mppe': 'prefer',
+ 'ppp_echo_failure' : '3',
+ 'ppp_echo_interval' : '30',
+ 'ppp_echo_timeout': '0',
'radius_server': [],
'radius_acct_tmo': '3',
'radius_max_try': '3',
@@ -282,29 +285,22 @@ def get_config():
'client-ip-pool subnet')[0])
l2tp['gateway_address'] = lst_ip[0]
+ # LNS secret
+ if conf.exists(['lns', 'shared-secret']):
+ l2tp['lns_shared_secret'] = conf.return_value(['lns', 'shared-secret'])
- if conf.exists('idle'):
- l2tp['idle_timeout'] = conf.return_value('idle')
+ if conf.exists(['ccp-disable']):
+ l2tp[['ccp_disable']] = True
- # LNS secret
- if conf.exists('lns shared-secret'):
- l2tp['lns_shared_secret'] = conf.return_value('lns shared-secret')
-
- if conf.exists('ccp-disable'):
- l2tp['ccp_disable'] = True
-
- # ppp_options
- ppp_options = {}
- if conf.exists('ppp-options'):
- if conf.exists('ppp-options lcp-echo-failure'):
- ppp_options['lcp-echo-failure'] = conf.return_value(
- 'ppp-options lcp-echo-failure')
- if conf.exists('ppp-options lcp-echo-interval'):
- ppp_options['lcp-echo-interval'] = conf.return_value(
- 'ppp-options lcp-echo-interval')
-
- if len(ppp_options) != 0:
- l2tp['ppp_options'] = ppp_options
+ # PPP options
+ if conf.exists(['idle']):
+ l2tp['ppp_echo_timeout'] = conf.return_value(['idle'])
+
+ if conf.exists(['ppp-options', 'lcp-echo-failure']):
+ l2tp['ppp_echo_failure'] = conf.return_value(['ppp-options', 'lcp-echo-failure'])
+
+ if conf.exists(['ppp-options', 'lcp-echo-interval']):
+ l2tp['ppp_echo_interval'] = conf.return_value(['ppp-options', 'lcp-echo-interval'])
import pprint
pprint.pprint(l2tp)