diff mbox series

[xtables,05/13] arptables: add basic test infra for arptables-nft

Message ID 20181112141900.7366-6-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series arptables: make it work | expand

Commit Message

Florian Westphal Nov. 12, 2018, 2:18 p.m. UTC
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 iptables-test.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/iptables-test.py b/iptables-test.py
index 34a040422ce7..532dee7c9000 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -17,10 +17,12 @@  import argparse
 
 IPTABLES = "iptables"
 IP6TABLES = "ip6tables"
+ARPTABLES = "arptables"
 EBTABLES = "ebtables"
 
 IPTABLES_SAVE = "iptables-save"
 IP6TABLES_SAVE = "ip6tables-save"
+ARPTABLES_SAVE = "arptables-save"
 EBTABLES_SAVE = "ebtables-save"
 #IPTABLES_SAVE = ['xtables-save','-4']
 #IP6TABLES_SAVE = ['xtables-save','-6']
@@ -111,6 +113,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] == ARPTABLES:
+            command = ARPTABLES_SAVE
         elif splitted[0] == EBTABLES:
             command = EBTABLES_SAVE
 
@@ -159,7 +163,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 ') or cmd.startswith('ebtables '):
+    if cmd.startswith('iptables ') or cmd.startswith('ip6tables ') or cmd.startswith('ebtables ') or cmd.startswith('arptables '):
         cmd = os.path.abspath(os.path.curdir) + "/iptables/" + EXECUTEABLE + " " + cmd
 
     print >> log_file, "command: %s" % cmd
@@ -192,6 +196,11 @@  def run_test_file(filename, netns):
         iptables = IP6TABLES
     elif "libxt_"  in filename:
         iptables = IPTABLES
+    elif "libarpt_" in filename:
+        # only supported with nf_tables backend
+        if EXECUTEABLE != "xtables-nft-multi":
+           return 0, 0
+        iptables = ARPTABLES
     elif "libebt_" in filename:
         # only supported with nf_tables backend
         if EXECUTEABLE != "xtables-nft-multi":