]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: iptables-test: Add nft-compat variant
authorPhil Sutter <phil@nwl.cc>
Wed, 9 Oct 2024 09:46:37 +0000 (11:46 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 10 Apr 2025 16:45:46 +0000 (18:45 +0200)
Test iptables-nft with forced compat extension restore as third modus
operandi.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables-test.py

index 66db552185bc348d6b7b315cf3857fb04ba7e2bf..be47a6539965f97eb8d5fd32b4d641fa1d9c3920 100755 (executable)
@@ -613,6 +613,8 @@ def main():
                         help='Check for missing tests')
     parser.add_argument('-n', '--nftables', action='store_true',
                         help='Test iptables-over-nftables')
+    parser.add_argument('--compat', action='store_true',
+                        help='Test iptables-over-nftables in forced compat mode')
     parser.add_argument('-N', '--netns', action='store_const',
                         const='____iptables-container-test',
                         help='Test netnamespace path')
@@ -632,8 +634,10 @@ def main():
         variants.append("legacy")
     if args.nftables:
         variants.append("nft")
+    if args.compat:
+        variants.append("nft-compat")
     if len(variants) == 0:
-        variants = [ "legacy", "nft" ]
+        variants = [ "legacy", "nft", "nft-compat" ]
 
     if os.getuid() != 0:
         print("You need to be root to run this, sorry", file=sys.stderr)
@@ -652,8 +656,14 @@ def main():
     total_passed = 0
     total_tests = 0
     for variant in variants:
+
+        exec_infix = variant
+        if variant == "nft-compat":
+            os.putenv("XTABLES_COMPAT", "2")
+            exec_infix = "nft"
+
         global EXECUTABLE
-        EXECUTABLE = "xtables-" + variant + "-multi"
+        EXECUTABLE = "xtables-" + exec_infix + "-multi"
 
         test_files = 0
         tests = 0