summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2023-12-12 20:37:04 +0000
committerGitHub <noreply@github.com>2023-12-12 20:37:04 +0000
commita2b9477a3484999ca5d1acd65fbb19af4a5c1162 (patch)
tree00b9e6dfa73104f871c6edd2dfb9e035af384ae1 /src
parent138fe52743703aa771f388da026816c671e7d25b (diff)
parent5cb95aed965b45a900c6ba97c0bccefed83332b6 (diff)
downloadvyos-1x-a2b9477a3484999ca5d1acd65fbb19af4a5c1162.tar.gz
vyos-1x-a2b9477a3484999ca5d1acd65fbb19af4a5c1162.zip
Merge pull request #2611 from nicolas-fort/T5804-mig-script
T5804: nat: remove inbound|outbound interface from old configuration when it was set to <any>.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/migration-scripts/nat/6-to-78
1 files changed, 6 insertions, 2 deletions
diff --git a/src/migration-scripts/nat/6-to-7 b/src/migration-scripts/nat/6-to-7
index b5f6328ef..a2e735394 100755
--- a/src/migration-scripts/nat/6-to-7
+++ b/src/migration-scripts/nat/6-to-7
@@ -21,6 +21,7 @@
# to
# 'set nat [source|destination] rule X [inbound-interface|outbound interface] name <iface>'
# 'set nat [source|destination] rule X [inbound-interface|outbound interface] group <iface_group>'
+# Also remove command if interface == any
from sys import argv,exit
from vyos.configtree import ConfigTree
@@ -56,8 +57,11 @@ for direction in ['source', 'destination']:
if config.exists(base + [iface]):
if config.exists(base + [iface, 'interface-name']):
tmp = config.return_value(base + [iface, 'interface-name'])
- config.delete(base + [iface, 'interface-name'])
- config.set(base + [iface, 'name'], value=tmp)
+ if tmp != 'any':
+ config.delete(base + [iface, 'interface-name'])
+ config.set(base + [iface, 'name'], value=tmp)
+ else:
+ config.delete(base + [iface])
try:
with open(file_name, 'w') as f: