]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: add basic ebtables test support
authorFlorian Westphal <fw@strlen.de>
Fri, 2 Nov 2018 11:06:30 +0000 (12:06 +0100)
committerFlorian Westphal <fw@strlen.de>
Sat, 3 Nov 2018 19:35:22 +0000 (20:35 +0100)
now that we have ebtables-save, lets add test cases for ebtables-nft
as well.

Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libebt_standard.t [new file with mode: 0644]
iptables-test.py

diff --git a/extensions/libebt_standard.t b/extensions/libebt_standard.t
new file mode 100644 (file)
index 0000000..59ca337
--- /dev/null
@@ -0,0 +1,6 @@
+:INPUT,FORWARD,OUTPUT
+-s 0:0:0:0:0:0;=;OK
+-d 00:00:0:00:00:00;-d 0:0:0:0:0:0;OK
+-s de:ad:be:ef:0:00 -j RETURN;-s de:ad:be:ef:0:0 -j RETURN;OK
+-d de:ad:be:ef:0:0;=;OK
+-d de:ad:be:ef:00:00/ff:ff:ff:ff:00:00 -j DROP;-d de:ad:be:ef:0:0/ff:ff:ff:ff:0:0 -j DROP;OK
index 331fe59d6199d07065ba51f24cd0fc41ed3b3390..c199d509ef8f8a5fba4eb3399c9a9c6fa0417017 100755 (executable)
@@ -17,11 +17,11 @@ import argparse
 
 IPTABLES = "iptables"
 IP6TABLES = "ip6tables"
-#IPTABLES = "xtables -4"
-#IP6TABLES = "xtables -6"
+EBTABLES = "ebtables"
 
 IPTABLES_SAVE = "iptables-save"
 IP6TABLES_SAVE = "ip6tables-save"
+EBTABLES_SAVE = "ebtables-save"
 #IPTABLES_SAVE = ['xtables-save','-4']
 #IP6TABLES_SAVE = ['xtables-save','-6']
 
@@ -111,6 +111,8 @@ def run_test(iptables, rule, rule_save, res, filename, lineno, netns):
             command = IPTABLES_SAVE
         elif splitted[0] == IP6TABLES:
             command = IP6TABLES_SAVE
+        elif splitted[0] == EBTABLES:
+            command = EBTABLES_SAVE
 
     path = os.path.abspath(os.path.curdir) + "/iptables/" + EXECUTEABLE
     command = path + " " + command
@@ -157,7 +159,7 @@ def execute_cmd(cmd, filename, lineno):
     :param lineno: line number being tested (used for print_error purposes)
     '''
     global log_file
-    if cmd.startswith('iptables ') or cmd.startswith('ip6tables '):
+    if cmd.startswith('iptables ') or cmd.startswith('ip6tables ') or cmd.startswith('ebtables '):
         cmd = os.path.abspath(os.path.curdir) + "/iptables/" + EXECUTEABLE + " " + cmd
 
     print >> log_file, "command: %s" % cmd
@@ -190,6 +192,11 @@ def run_test_file(filename, netns):
         iptables = IP6TABLES
     elif "libxt_"  in filename:
         iptables = IPTABLES
+    elif "libebt_" in filename:
+        # only supported with nf_tables backend
+        if EXECUTEABLE != "xtables-nft-multi":
+           return 0, 0
+        iptables = EBTABLES
     else:
         # default to iptables if not known prefix
         iptables = IPTABLES