diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-11-03 19:55:23 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-11-03 19:57:48 +0100 |
commit | 8ec9a2dc7c149a7565e4e9823a8ccfc3bba3bce4 (patch) | |
tree | 93218c39bfe3e525446bb1cb881fff18e5dbd235 | |
parent | 2ed561e249e7f44d1269879bcf55cb83aee2324a (diff) | |
download | vyos-1x-8ec9a2dc7c149a7565e4e9823a8ccfc3bba3bce4.tar.gz vyos-1x-8ec9a2dc7c149a7565e4e9823a8ccfc3bba3bce4.zip |
sstp: T2566: use XML defaultValue over Jinja2 hardcoded value
(cherry picked from commit 01ed77040ec9493e4ca1cf868ff3c22847da4487)
-rw-r--r-- | data/templates/accel-ppp/config_ipv6_pool.j2 | 2 | ||||
-rw-r--r-- | interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i | 1 | ||||
-rw-r--r-- | python/vyos/configdict.py | 14 |
3 files changed, 16 insertions, 1 deletions
diff --git a/data/templates/accel-ppp/config_ipv6_pool.j2 b/data/templates/accel-ppp/config_ipv6_pool.j2 index 093887f7e..f45bf9442 100644 --- a/data/templates/accel-ppp/config_ipv6_pool.j2 +++ b/data/templates/accel-ppp/config_ipv6_pool.j2 @@ -5,7 +5,7 @@ AdvAutonomousFlag=1 {% if client_ipv6_pool.prefix is defined and client_ipv6_pool.prefix is not none %} [ipv6-pool] {% for prefix, options in client_ipv6_pool.prefix.items() %} -{{ prefix }},{{ '64 ' if options.mask is not defined else options.mask }} +{{ prefix }},{{ options.mask }} {% endfor %} {% if client_ipv6_pool.delegate is defined and client_ipv6_pool.delegate is not none %} {% for prefix, options in client_ipv6_pool.delegate.items() %} diff --git a/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i b/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i index bd3dadf8d..a692f2335 100644 --- a/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i +++ b/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i @@ -27,6 +27,7 @@ <validator name="numeric" argument="--range 48-128"/> </constraint> </properties> + <defaultValue>64</defaultValue> </leafNode> </children> </tagNode> diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 8308f0e9b..afdd62a73 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -532,6 +532,11 @@ def get_accel_dict(config, base, chap_secrets): if dict_search('authentication.local_users.username', default_values): del default_values['authentication']['local_users']['username'] + # T2665: defaults include IPv6 client-pool mask per TAG node which need to be + # added to individual local users instead - so we can simply delete them + if dict_search('client_ipv6_pool.prefix.mask', default_values): + del default_values['client_ipv6_pool']['prefix']['mask'] + dict = dict_merge(default_values, dict) # set CPUs cores to process requests @@ -575,4 +580,13 @@ def get_accel_dict(config, base, chap_secrets): dict['authentication']['local_users']['username'][username] = dict_merge( default_values, dict['authentication']['local_users']['username'][username]) + # Add individual IPv6 client-pool default mask if required + if dict_search('client_ipv6_pool.prefix', dict): + # T2665 + default_values = defaults(base + ['client-ipv6-pool', 'prefix']) + + for prefix in dict_search('client_ipv6_pool.prefix', dict): + dict['client_ipv6_pool']['prefix'][prefix] = dict_merge( + default_values, dict['client_ipv6_pool']['prefix'][prefix]) + return dict |