diff options
author | Christian Breunig <christian@breunig.cc> | 2023-08-27 12:33:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-27 12:33:15 +0200 |
commit | d3edda22573fb9c9d1c469f14f5a3eec9ca512a5 (patch) | |
tree | c6118e7d1dc94b2963f69b7c504738320fb0a809 /smoketest | |
parent | 904cbe448c578905c9af1d15059f2905c490e409 (diff) | |
parent | 6b5d3568b88fad9cda694c0cd8b82c1f16773b15 (diff) | |
download | vyos-1x-d3edda22573fb9c9d1c469f14f5a3eec9ca512a5.tar.gz vyos-1x-d3edda22573fb9c9d1c469f14f5a3eec9ca512a5.zip |
Merge pull request #2176 from sarthurdev/T5080
firewall: T5080: Disable conntrack unless required by rules
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_firewall.py | 15 |
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']) |