support/testing: TestIptables: check for netfilter legacy tables enabled

TestIptables expect netfilter legacy tables enabled in the kernel.

Make sure we use iptables-legacy:

  iptables --version
  iptables v1.8.11 (legacy)

The test would fail if nftables compat (iptables-nft) is enabled.

  iptables --version
  iptables v1.8.11 (nf_tables)

Add the following configuration fragment to enable iptables-nft:

  BR2_PACKAGE_IPTABLES_NFTABLES=y
  BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT=y

Acked-by: Fiona Klute <fiona.klute@gmx.de>
Tested-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
This commit is contained in:
Romain Naour
2026-06-24 14:51:53 +02:00
committed by Fiona Klute
parent c57bcf0d43
commit 1b2f65bbe9

View File

@@ -38,7 +38,10 @@ class TestIptables(infra.basetest.BRTest):
self.emulator.login()
# We check the program can execute.
self.assertRunOk("iptables --version")
cmd = "iptables --version"
output, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
self.assertTrue(output[0].endswith("(legacy)"))
# We delete all rules in all chains. We also set default
# policies to ACCEPT for INPUT and OUTPUT chains. This should