From fbf0bf7c079d8094accd57643b7eccc6b96423f2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 6 Aug 2018 17:21:59 +0200 Subject: tests: Add ebtables-{save,restore} testcases This actually does a bit more since it creates the ruleset using separate ebtables 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 --- .../ebtables/0003-ebtables-restore-defaults_0 | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0 (limited to 'iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0') diff --git a/iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0 b/iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0 new file mode 100755 index 00000000..8f7e7da0 --- /dev/null +++ b/iptables/tests/shell/testcases/ebtables/0003-ebtables-restore-defaults_0 @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# there is no legacy backend to test +[[ $XT_MULTI == "*xtables-nft-multi" ]] || exit 0 + +# ebtables-restore reuses preloaded targets and matches, make sure defaults +# apply to consecutive rules using the same target/match as a previous one + +DUMP='*filter +:FORWARD ACCEPT +-A FORWARD --limit 100 --limit-burst 42 -j ACCEPT +-A FORWARD --limit 1000 -j ACCEPT +-A FORWARD --log --log-prefix "foobar" +-A FORWARD --log +' + +# note how limit-burst is 5 in second rule and log-prefix empty in fourth one + +EXPECT='*filter +:INPUT ACCEPT +:FORWARD ACCEPT +:OUTPUT ACCEPT +-A FORWARD --limit 100/second --limit-burst 42 -j ACCEPT +-A FORWARD --limit 1000/second --limit-burst 5 -j ACCEPT +-A FORWARD --log-level notice --log-prefix "foobar" -j CONTINUE +-A FORWARD --log-level notice --log-prefix "" -j CONTINUE +' + +$XT_MULTI ebtables --init-table +$XT_MULTI ebtables-restore <<<$DUMP +diff -u <(echo -e "$EXPECT") <($XT_MULTI ebtables-save | grep -v '^#') -- cgit v1.2.3