]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables-test: fix bug with rateest
authorFlorian Westphal <fw@strlen.de>
Sun, 6 May 2018 22:05:11 +0000 (00:05 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 6 May 2018 22:08:09 +0000 (00:08 +0200)
rateest test needs to insert rateest targets with
@progname syntax.

However, this used the system-installed binary rather than the one
from git.

Morever, it did not respect --nftables switch, i.e. add occurs with
iptables so iptables-compat won't find it.

Fixes: d7ac61b58e78 ("add nft switch and test binaries from git")
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables-test.py

index f3ec1b5c5f3d8902ee3c7d6e731886482fa06025..75095d2de5559a7623d312c7a6813521ca77a612 100755 (executable)
@@ -51,7 +51,7 @@ def delete_rule(iptables, rule, filename, lineno):
     '''
     Removes an iptables rule
     '''
-    cmd = EXECUTEABLE + " " + iptables + " -D " + rule
+    cmd = iptables + " -D " + rule
     ret = execute_cmd(cmd, filename, lineno)
     if ret == 1:
         reason = "cannot delete: " + iptables + " -I " + rule
@@ -75,7 +75,7 @@ def run_test(iptables, rule, rule_save, res, filename, lineno):
     '''
     ret = 0
 
-    cmd = EXECUTEABLE + " " + iptables + " -A " + rule
+    cmd = iptables + " -A " + rule
     ret = execute_cmd(cmd, filename, lineno)
 
     #
@@ -144,6 +144,9 @@ 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 '):
+        cmd = os.path.abspath(os.path.curdir) + "/iptables/" + EXECUTEABLE + " " + cmd
+
     print >> log_file, "command: %s" % cmd
     ret = subprocess.call(cmd, shell=True, universal_newlines=True,
         stderr=subprocess.STDOUT, stdout=log_file)