diff options
-rw-r--r-- | data/templates/l2tp/l2tp.config.tmpl | 16 | ||||
-rwxr-xr-x | src/conf_mode/vpn_l2tp.py | 38 |
2 files changed, 20 insertions, 34 deletions
diff --git a/data/templates/l2tp/l2tp.config.tmpl b/data/templates/l2tp/l2tp.config.tmpl index 6ebbf1241..f4746a6a1 100644 --- a/data/templates/l2tp/l2tp.config.tmpl +++ b/data/templates/l2tp/l2tp.config.tmpl @@ -105,19 +105,9 @@ bind={{ radius_source_address }} verbose=1 check-ip=1 single-session=replace -{% if idle_timeout %} -lcp-echo-timeout={{idle_timeout}} -{% endif %} -{% if ppp_options['lcp-echo-interval'] %} -lcp-echo-interval={{ppp_options['lcp-echo-interval']}} -{% else %} -lcp-echo-interval=30 -{% endif %} -{% if ppp_options['lcp-echo-failure'] %} -lcp-echo-failure={{ppp_options['lcp-echo-failure']}} -{% else %} -lcp-echo-failure=3 -{% endif %} +lcp-echo-timeout={{ ppp_echo_timeout }} +lcp-echo-interval={{ ppp_echo_interval }} +lcp-echo-failure={{ ppp_echo_failure }} {% if ccp_disable %} ccp=0 {% endif %} 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) |