summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2023-08-26 23:02:10 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2023-08-26 23:20:22 +0200
commit6b5d3568b88fad9cda694c0cd8b82c1f16773b15 (patch)
tree22360fa716d82bcde58025885ed78c6acb5bae47 /smoketest/scripts
parent75aa90cf2b234a34565d165697196ac9a304bb66 (diff)
downloadvyos-1x-6b5d3568b88fad9cda694c0cd8b82c1f16773b15.tar.gz
vyos-1x-6b5d3568b88fad9cda694c0cd8b82c1f16773b15.zip
firewall: T5080: Disable conntrack unless required by rules
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-xsmoketest/scripts/cli/test_firewall.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_firewall.py b/smoketest/scripts/cli/test_firewall.py
index c6514210b..ee6ccb710 100755
--- a/smoketest/scripts/cli/test_firewall.py
+++ b/smoketest/scripts/cli/test_firewall.py
@@ -78,6 +78,17 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
break
self.assertTrue(not matched if inverse else matched, msg=search)
+ def verify_nftables_chain(self, nftables_search, table, chain, inverse=False, args=''):
+ nftables_output = cmd(f'sudo nft {args} list chain {table} {chain}')
+
+ for search in nftables_search:
+ matched = False
+ for line in nftables_output.split("\n"):
+ if all(item in line for item in search):
+ matched = True
+ break
+ self.assertTrue(not matched if inverse else matched, msg=search)
+
def wait_for_domain_resolver(self, table, set_name, element, max_wait=10):
# Resolver no longer blocks commit, need to wait for daemon to populate set
count = 0
@@ -511,6 +522,10 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase):
self.verify_nftables(nftables_search, 'ip vyos_filter')
+ # Check conntrack
+ self.verify_nftables_chain([['accept']], 'raw', 'FW_CONNTRACK')
+ self.verify_nftables_chain([['return']], 'ip6 raw', 'FW_CONNTRACK')
+
def test_source_validation(self):
# Strict
self.cli_set(['firewall', 'global-options', 'source-validation', 'strict'])