summaryrefslogtreecommitdiff
path: root/src/migration-scripts/l2tp
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-11 15:12:52 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-11 15:12:52 +0200
commit07080afd4015a900fb7474e1c81008f58b478565 (patch)
tree3d879f900b09f1437d8063a594a3c98dcb52008d /src/migration-scripts/l2tp
parentf8e9d1ecea05aa40555b7eb7e337f7fb9e495bae (diff)
downloadvyos-1x-07080afd4015a900fb7474e1c81008f58b478565.tar.gz
vyos-1x-07080afd4015a900fb7474e1c81008f58b478565.zip
vpn: l2tp: T2264: migrate IPv6 prefix node to common CLI style
Combining multiple options into a single CLI node is considered bad practice. IPv6 prefixes consited of the prefix itself and a mask send to the client in one node only. The following CLI parts have been migrated from client-ipv6-pool { delegate-prefix fc00:0:1::/48,64 prefix 2001:db8::/64,64 } to client-ipv6-pool { delegate fc00:0:1::/48 { delegation-prefix 48 } prefix 2001:db8::/48 { mask 64 } } Thus regular validation steps from the VyOS CLI can be used when a prefix is configured.
Diffstat (limited to 'src/migration-scripts/l2tp')
-rwxr-xr-xsrc/migration-scripts/l2tp/2-to-328
1 files changed, 28 insertions, 0 deletions
diff --git a/src/migration-scripts/l2tp/2-to-3 b/src/migration-scripts/l2tp/2-to-3
index e24d1ffa9..bd0839e03 100755
--- a/src/migration-scripts/l2tp/2-to-3
+++ b/src/migration-scripts/l2tp/2-to-3
@@ -75,6 +75,34 @@ else:
if config.exists(radius_base + ['server', server, 'req-limit']):
config.delete(radius_base + ['server', server, 'req-limit'])
+ # Migrate IPv6 prefixes
+ ipv6_base = base + ['client-ipv6-pool']
+ if config.exists(ipv6_base + ['prefix']):
+ prefix_old = config.return_values(ipv6_base + ['prefix'])
+ # delete old prefix CLI nodes
+ config.delete(ipv6_base + ['prefix'])
+ # create ned prefix tag node
+ config.set(ipv6_base + ['prefix'])
+ config.set_tag(ipv6_base + ['prefix'])
+
+ for p in prefix_old:
+ prefix = p.split(',')[0]
+ mask = p.split(',')[1]
+ config.set(ipv6_base + ['prefix', prefix, 'mask'], value=mask)
+
+ if config.exists(ipv6_base + ['delegate-prefix']):
+ prefix_old = config.return_values(ipv6_base + ['delegate-prefix'])
+ # delete old delegate prefix CLI nodes
+ config.delete(ipv6_base + ['delegate-prefix'])
+ # create ned delegation tag node
+ config.set(ipv6_base + ['delegate '])
+ config.set_tag(ipv6_base + ['delegate '])
+
+ for p in prefix_old:
+ prefix = p.split(',')[0]
+ mask = p.split(',')[1]
+ config.set(ipv6_base + ['delegate', prefix, 'mask'], value=mask)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())