|
|
8cce6c |
From a63cfa813bb173414bfe37f8a8e2e5f96a99bb99 Mon Sep 17 00:00:00 2001
|
|
|
8cce6c |
From: Phil Sutter <phil@nwl.cc>
|
|
|
8cce6c |
Date: Thu, 31 Jan 2019 16:12:56 +0100
|
|
|
8cce6c |
Subject: [PATCH] tests: shell: Add arptables-nft verbose output test
|
|
|
8cce6c |
|
|
|
8cce6c |
With arptables-nft output being in a very good state now, add a test to
|
|
|
8cce6c |
ensure it stays that way.
|
|
|
8cce6c |
|
|
|
8cce6c |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
8cce6c |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
8cce6c |
(cherry picked from commit 3d8f261c565a024c13d627b18a0fcafc76de8f2c)
|
|
|
8cce6c |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
8cce6c |
---
|
|
|
8cce6c |
.../arptables/0003-arptables-verbose-output_0 | 64 +++++++++++++++++++
|
|
|
8cce6c |
1 file changed, 64 insertions(+)
|
|
|
8cce6c |
create mode 100755 iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0
|
|
|
8cce6c |
|
|
|
8cce6c |
diff --git a/iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0 b/iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0
|
|
|
8cce6c |
new file mode 100755
|
|
|
8cce6c |
index 0000000000000..35126fa7d717c
|
|
|
8cce6c |
--- /dev/null
|
|
|
8cce6c |
+++ b/iptables/tests/shell/testcases/arptables/0003-arptables-verbose-output_0
|
|
|
8cce6c |
@@ -0,0 +1,64 @@
|
|
|
8cce6c |
+#!/bin/bash
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+set -e
|
|
|
8cce6c |
+set -x
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+# there is no legacy backend to test
|
|
|
8cce6c |
+[[ $XT_MULTI == */xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; }
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+$XT_MULTI arptables -N foo
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+# check verbose output matches expectations
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE1='-i eth23 -j ACCEPT'
|
|
|
8cce6c |
+VOUT1='-j ACCEPT -i eth23 -o *'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE2='-i eth23'
|
|
|
8cce6c |
+VOUT2='-i eth23 -o *'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE3='-i eth23 -j MARK --set-mark 42'
|
|
|
8cce6c |
+VOUT3='-j MARK -i eth23 -o * --set-mark 42'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE4='-o eth23 -j CLASSIFY --set-class 23:42'
|
|
|
8cce6c |
+VOUT4='-j CLASSIFY -i * -o eth23 --set-class 23:42'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE5='-o eth23 -j foo'
|
|
|
8cce6c |
+VOUT5='-j foo -i * -o eth23'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+RULE6='-o eth23 -j mangle --mangle-ip-s 10.0.0.1'
|
|
|
8cce6c |
+VOUT6='-j mangle -i * -o eth23 --mangle-ip-s 10.0.0.1'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT1") <($XT_MULTI arptables -v -A INPUT $RULE1)
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT2") <($XT_MULTI arptables -v -A INPUT $RULE2)
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT3") <($XT_MULTI arptables -v -A INPUT $RULE3)
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT4") <($XT_MULTI arptables -v -A OUTPUT $RULE4)
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT5") <($XT_MULTI arptables -v -A OUTPUT $RULE5)
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$VOUT6") <($XT_MULTI arptables -v -A foo $RULE6)
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+EXPECT='Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
|
|
|
8cce6c |
+-j ACCEPT -i eth23 -o *, pcnt=0 -- bcnt=0
|
|
|
8cce6c |
+-i eth23 -o *, pcnt=0 -- bcnt=0
|
|
|
8cce6c |
+-j MARK -i eth23 -o * --set-mark 42, pcnt=0 -- bcnt=0
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
|
|
|
8cce6c |
+-j CLASSIFY -i * -o eth23 --set-class 23:42, pcnt=0 -- bcnt=0
|
|
|
8cce6c |
+-j foo -i * -o eth23, pcnt=0 -- bcnt=0
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+Chain foo (1 references)
|
|
|
8cce6c |
+-j mangle -i * -o eth23 --mangle-ip-s 10.0.0.1, pcnt=0 -- bcnt=0'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI arptables -v -n -L)
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+EXPECT='*filter
|
|
|
8cce6c |
+:INPUT ACCEPT
|
|
|
8cce6c |
+:OUTPUT ACCEPT
|
|
|
8cce6c |
+:foo -
|
|
|
8cce6c |
+-A INPUT -j ACCEPT -i eth23
|
|
|
8cce6c |
+-A INPUT -i eth23
|
|
|
8cce6c |
+-A INPUT -j MARK -i eth23 --set-mark 42
|
|
|
8cce6c |
+-A OUTPUT -j CLASSIFY -o eth23 --set-class 23:42
|
|
|
8cce6c |
+-A OUTPUT -j foo -o eth23
|
|
|
8cce6c |
+-A foo -j mangle -o eth23 --mangle-ip-s 10.0.0.1
|
|
|
8cce6c |
+'
|
|
|
8cce6c |
+
|
|
|
8cce6c |
+diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI arptables-save)
|
|
|
8cce6c |
--
|
|
|
8cce6c |
2.20.1
|
|
|
8cce6c |
|