summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Fort <nicolasfort1988@gmail.com>2024-03-05 10:54:37 +0000
committerNicolas Fort <nicolasfort1988@gmail.com>2024-03-05 10:54:37 +0000
commit8f2534e9654b61b7db45788bb52ac6cf8017b054 (patch)
treef51f5f4533a6b4229125fc361b1cbca160b1f996
parent450bb16795305e32e46b21da4bb5913843d9d871 (diff)
downloadvyos-1x-8f2534e9654b61b7db45788bb52ac6cf8017b054.tar.gz
vyos-1x-8f2534e9654b61b7db45788bb52ac6cf8017b054.zip
T6061: fix rule parsing when connection-status is used
-rw-r--r--python/vyos/firewall.py4
-rwxr-xr-xsmoketest/scripts/cli/test_firewall.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py
index 49e095946..e70b4f0d9 100644
--- a/python/vyos/firewall.py
+++ b/python/vyos/firewall.py
@@ -136,10 +136,10 @@ def parse_rule(rule_conf, hook, fw_name, rule_id, ip_name):
if 'connection_status' in rule_conf and rule_conf['connection_status']:
status = rule_conf['connection_status']
if status['nat'] == 'destination':
- nat_status = '{dnat}'
+ nat_status = 'dnat'
output.append(f'ct status {nat_status}')
if status['nat'] == 'source':
- nat_status = '{snat}'
+ nat_status = 'snat'
output.append(f'ct status {nat_status}')
if 'protocol' in rule_conf and rule_conf['protocol'] != 'all':
diff --git a/smoketest/scripts/cli/test_firewall.py b/smoketest/scripts/cli/test_firewall.py
index be5960bbd..9e8473fa4 100755
--- a/smoketest/scripts/cli/test_firewall.py
+++ b/smoketest/scripts/cli/test_firewall.py
@@ -629,8 +629,8 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
nftables_search = [
['ct state { established, related }', 'accept'],
['ct state invalid', 'reject'],
- ['ct state new', 'ct status == dnat', 'accept'],
- ['ct state { established, new }', 'ct status == snat', 'accept'],
+ ['ct state new', 'ct status dnat', 'accept'],
+ ['ct state { established, new }', 'ct status snat', 'accept'],
['ct state related', 'ct helper { "ftp", "pptp" }', 'accept'],
['drop', f'comment "{name} default-action drop"'],
['jump VYOS_STATE_POLICY'],