diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-11-10 20:21:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-10 20:21:01 +0100 |
commit | cc13dc3ea36997c080870ea394e92cec969c8118 (patch) | |
tree | c38c10d45e233056e1f9c689ac93ef18fcaada09 /src/conf_mode/accel_l2tp.py | |
parent | cc2ea329b1bb2ac23ffcc64892e831e7978023e2 (diff) | |
parent | fefb96e45b1eb48e2f0ad204528c62ba8c858aa3 (diff) | |
download | vyos-1x-cc13dc3ea36997c080870ea394e92cec969c8118.tar.gz vyos-1x-cc13dc3ea36997c080870ea394e92cec969c8118.zip |
Merge pull request #158 from DmitriyEshenko/cur-fix-l2tp
l2tp: T1747: automatically calculate gw-ip-address.
Diffstat (limited to 'src/conf_mode/accel_l2tp.py')
-rwxr-xr-x | src/conf_mode/accel_l2tp.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/conf_mode/accel_l2tp.py b/src/conf_mode/accel_l2tp.py index 244a720db..37fda2029 100755 --- a/src/conf_mode/accel_l2tp.py +++ b/src/conf_mode/accel_l2tp.py @@ -125,6 +125,9 @@ gw-ip-address={{outside_nexthop}} {% if authentication['mode'] == 'local' %} [chap-secrets] chap-secrets=/etc/accel-ppp/l2tp/chap-secrets +{% if outside_nexthop %} +gw-ip-address={{outside_nexthop}} +{% endif %} {% endif %} [ppp] @@ -287,7 +290,7 @@ def get_config(): 'mppe' : 'prefer' }, 'outside_addr' : '', - 'outside_nexthop' : '', + 'outside_nexthop' : '10.255.255.0', 'dns' : [], 'dnsv6' : [], 'wins' : [], @@ -429,7 +432,16 @@ def get_config(): ### gateway address if c.exists('outside-nexthop'): config_data['outside_nexthop'] = c.return_value('outside-nexthop') - + else: + ### calculate gw-ip-address + if c.exists('client-ip-pool start'): + ### use start ip as gw-ip-address + config_data['outside_nexthop'] = c.return_value('client-ip-pool start') + elif c.exists('client-ip-pool subnet'): + ### use first ip address from first defined pool + lst_ip = re.findall("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", c.return_values('client-ip-pool subnet')[0]) + config_data['outside_nexthop'] = lst_ip[0] + if c.exists('authentication require'): auth_mods = {'pap' : 'pap','chap' : 'auth_chap_md5', 'mschap' : 'auth_mschap_v1', 'mschap-v2' : 'auth_mschap_v2'} for proto in c.return_values('authentication require'): |