summaryrefslogtreecommitdiff
path: root/src/migration-scripts/firewall
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-03-25 18:21:17 +0100
committerGitHub <noreply@github.com>2026-03-25 18:21:17 +0100
commitb3a5356fb4c217ca9942a1d155f6c1c789dd62f6 (patch)
tree32dd90643a6fba26a9782b7667e753971d1fb8cf /src/migration-scripts/firewall
parent1b6729e34fa26f9a520e5c11d0e3ce71aefb5eb8 (diff)
parentf8c5643b36bd0df630453d8b6e5e25c6df984ec4 (diff)
downloadvyos-1x-b3a5356fb4c217ca9942a1d155f6c1c789dd62f6.tar.gz
vyos-1x-b3a5356fb4c217ca9942a1d155f6c1c789dd62f6.zip
Merge pull request #5087 from alexandr-san4ez/T8277-current
firewall: T8277: Resolve migration issue when using `port-group` with protocol `all`
Diffstat (limited to 'src/migration-scripts/firewall')
-rw-r--r--src/migration-scripts/firewall/6-to-720
1 files changed, 16 insertions, 4 deletions
diff --git a/src/migration-scripts/firewall/6-to-7 b/src/migration-scripts/firewall/6-to-7
index 2626d76ee..c914a71ee 100644
--- a/src/migration-scripts/firewall/6-to-7
+++ b/src/migration-scripts/firewall/6-to-7
@@ -194,8 +194,14 @@ def migrate(config: ConfigTree) -> None:
pg_base = base + ['name', name, 'rule', rule, direction, 'group', 'port-group']
proto_base = base + ['name', name, 'rule', rule, 'protocol']
- if config.exists(pg_base) and not config.exists(proto_base):
- config.set(proto_base, value='tcp_udp')
+ if config.exists(pg_base):
+ if config.exists(proto_base):
+ proto_name = config.return_value(proto_base)
+ set_as_tcp_udp = proto_name == 'all'
+ else:
+ set_as_tcp_udp = False
+ if set_as_tcp_udp:
+ config.set(proto_base, value='tcp_udp')
if '+' in name:
replacement_string = "_"
@@ -291,8 +297,14 @@ def migrate(config: ConfigTree) -> None:
pg_base = base + ['ipv6-name', name, 'rule', rule, direction, 'group', 'port-group']
proto_base = base + ['ipv6-name', name, 'rule', rule, 'protocol']
- if config.exists(pg_base) and not config.exists(proto_base):
- config.set(proto_base, value='tcp_udp')
+ if config.exists(pg_base):
+ if config.exists(proto_base):
+ proto_name = config.return_value(proto_base)
+ set_as_tcp_udp = proto_name == 'all'
+ else:
+ set_as_tcp_udp = False
+ if set_as_tcp_udp:
+ config.set(proto_base, value='tcp_udp')
if '+' in name:
replacement_string = "_"