diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-12-13 11:32:46 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-12-18 10:06:05 +0100 |
commit | fb9cea50e8b370b6931e7b53b1a881d3b95b1c91 (patch) | |
tree | 194a007ae2b989ab7488a8491d6e07d1585138c3 /tests/shell/testcases/chains | |
parent | 9ba5f4710fca93ae4c8c1d3cdf8c781328effbdc (diff) |
main: enforce options before commands
This patch turns on POSIXLY_CORRECT on the getopt parser to enforce
options before commands. Users get a hint in such a case:
# nft list ruleset -a
Error: syntax error, options must be specified before commands
nft list ruleset -a
^ ~~
This patch recovers 9fc71bc6b602 ("main: Fix for misleading error with
negative chain priority").
Tests have been updated.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/chains')
-rwxr-xr-x | tests/shell/testcases/chains/0016delete_handle_0 | 4 | ||||
-rwxr-xr-x | tests/shell/testcases/chains/0039negative_priority_0 | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/shell/testcases/chains/0016delete_handle_0 b/tests/shell/testcases/chains/0016delete_handle_0 index 4633d771..8fd1ad86 100755 --- a/tests/shell/testcases/chains/0016delete_handle_0 +++ b/tests/shell/testcases/chains/0016delete_handle_0 @@ -10,8 +10,8 @@ $NFT add chain ip6 test-ip6 x $NFT add chain ip6 test-ip6 y $NFT add chain ip6 test-ip6 z -chain_y_handle=$($NFT list ruleset -a | awk -v n=1 '/chain y/ && !--n {print $NF; exit}'); -chain_z_handle=$($NFT list ruleset -a | awk -v n=2 '/chain z/ && !--n {print $NF; exit}'); +chain_y_handle=$($NFT -a list ruleset | awk -v n=1 '/chain y/ && !--n {print $NF; exit}'); +chain_z_handle=$($NFT -a list ruleset | awk -v n=2 '/chain z/ && !--n {print $NF; exit}'); $NFT delete chain test-ip handle $chain_y_handle $NFT delete chain ip6 test-ip6 handle $chain_z_handle diff --git a/tests/shell/testcases/chains/0039negative_priority_0 b/tests/shell/testcases/chains/0039negative_priority_0 new file mode 100755 index 00000000..ba17b8cc --- /dev/null +++ b/tests/shell/testcases/chains/0039negative_priority_0 @@ -0,0 +1,8 @@ +#!/bin/bash + +# Test parsing of negative priority values + +set -e + +$NFT add table t +$NFT add chain t c { type filter hook input priority -30\; } |