From f1d8508fd6fdc6d70394ca6901b82149ab6c4f8e Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 6 Aug 2018 17:21:58 +0200 Subject: tests: Add arptables-{save,restore} testcases This actually does a bit more since it creates the ruleset using separate arptables calls. Note that there are a few commented out lines containing commands which don't apply for unknown reasons - something to investigate later. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- .../arptables/0002-arptables-restore-defaults_0 | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0 (limited to 'iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0') diff --git a/iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0 b/iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0 new file mode 100755 index 00000000..8bc4d08f --- /dev/null +++ b/iptables/tests/shell/testcases/arptables/0002-arptables-restore-defaults_0 @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +# there is no legacy backend to test +[[ $XT_MULTI == "*xtables-nft-multi" ]] || exit 0 + +# arptables-restore reuses preloaded targets and matches, make sure defaults +# apply to consecutive rules using the same target/match as a previous one + +DUMP='*filter +:OUTPUT ACCEPT +-A OUTPUT -j mangle --mangle-ip-s 10.0.0.1 +-A OUTPUT -j mangle --mangle-ip-d 10.0.0.2 +' + +# note how mangle-ip-s is unset in second rule + +EXPECT='*filter +:INPUT ACCEPT +:OUTPUT ACCEPT +-A OUTPUT -j mangle --mangle-ip-s 10.0.0.1 +-A OUTPUT -j mangle --mangle-ip-d 10.0.0.2 +' + +$XT_MULTI arptables -F +$XT_MULTI arptables-restore <<<$DUMP +diff -u <(echo -e "$EXPECT") <($XT_MULTI arptables-save | grep -v '^#') -- cgit v1.2.3