diff options
author | Phil Sutter <phil@nwl.cc> | 2018-05-09 16:03:43 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-09 18:29:21 +0200 |
commit | a4dab4ecde114e0b3a6537a5cc7accd60dd25f17 (patch) | |
tree | 04948f8b4ed5ac23f346a18e6a68ea4bd8d039a5 /tests/shell/testcases/rule_management/0002addinsertlocation_1 | |
parent | 816d8c7659c1d90ce6827baaa939820a3bae2ae0 (diff) |
tests/shell: Extend rule_management/0001addposition_0
Combine it with 0002insertposition_0 due to the many similarities,
extend it to test 'handle' and 'index' parameters as well and rename the
testcase accordingly.
Also add a new 0002addinsertlocation_1 which tests that wrong argument
to all of the location parameters fails.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/rule_management/0002addinsertlocation_1')
-rwxr-xr-x | tests/shell/testcases/rule_management/0002addinsertlocation_1 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/shell/testcases/rule_management/0002addinsertlocation_1 b/tests/shell/testcases/rule_management/0002addinsertlocation_1 new file mode 100755 index 00000000..b48d3d66 --- /dev/null +++ b/tests/shell/testcases/rule_management/0002addinsertlocation_1 @@ -0,0 +1,23 @@ +#!/bin/bash + +# test rule adding with invalid position/handle/index value + +RULESET="flush ruleset +table ip t { + chain c { + accept + accept + } +}" + +$NFT -f - <<< "$RULESET" + +for cmd in add insert; do + for keyword in position handle index; do + $NFT $cmd rule t c $keyword 5 drop 2>/dev/null || continue + + echo "E: invalid $keyword value allowed in $cmd command" >&2 + exit 0 + done +done +exit 1 |