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/optionals | |
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/optionals')
-rwxr-xr-x | tests/shell/testcases/optionals/comments_0 | 2 | ||||
-rwxr-xr-x | tests/shell/testcases/optionals/comments_handles_0 | 2 | ||||
-rwxr-xr-x | tests/shell/testcases/optionals/delete_object_handles_0 | 4 | ||||
-rwxr-xr-x | tests/shell/testcases/optionals/handles_0 | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/tests/shell/testcases/optionals/comments_0 b/tests/shell/testcases/optionals/comments_0 index 29b85062..ab859365 100755 --- a/tests/shell/testcases/optionals/comments_0 +++ b/tests/shell/testcases/optionals/comments_0 @@ -5,4 +5,4 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept comment test_comment -$NFT list table test -a | grep 'accept comment \"test_comment\"' >/dev/null +$NFT -a list table test | grep 'accept comment \"test_comment\"' >/dev/null diff --git a/tests/shell/testcases/optionals/comments_handles_0 b/tests/shell/testcases/optionals/comments_handles_0 index 30539bf0..a01df1df 100755 --- a/tests/shell/testcases/optionals/comments_handles_0 +++ b/tests/shell/testcases/optionals/comments_handles_0 @@ -6,5 +6,5 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept comment test_comment set -e -$NFT list table test -a | grep 'accept comment \"test_comment\" # handle '[[:digit:]]$ >/dev/null +$NFT -a list table test | grep 'accept comment \"test_comment\" # handle '[[:digit:]]$ >/dev/null $NFT list table test | grep 'accept comment \"test_comment\"' | grep -v '# handle '[[:digit:]]$ >/dev/null diff --git a/tests/shell/testcases/optionals/delete_object_handles_0 b/tests/shell/testcases/optionals/delete_object_handles_0 index d5d96547..a2ae4228 100755 --- a/tests/shell/testcases/optionals/delete_object_handles_0 +++ b/tests/shell/testcases/optionals/delete_object_handles_0 @@ -10,8 +10,8 @@ $NFT add quota ip6 test-ip6 http-quota over 25 mbytes $NFT add counter ip6 test-ip6 http-traffic $NFT add quota ip6 test-ip6 ssh-quota 10 mbytes -counter_handle=$($NFT list ruleset -a | awk '/https-traffic/{print $NF}') -quota_handle=$($NFT list ruleset -a | awk '/ssh-quota/{print $NF}') +counter_handle=$($NFT -a list ruleset | awk '/https-traffic/{print $NF}') +quota_handle=$($NFT -a list ruleset | awk '/ssh-quota/{print $NF}') $NFT delete counter test-ip handle $counter_handle $NFT delete quota ip6 test-ip6 handle $quota_handle diff --git a/tests/shell/testcases/optionals/handles_0 b/tests/shell/testcases/optionals/handles_0 index 7c6a437c..80f3c5b2 100755 --- a/tests/shell/testcases/optionals/handles_0 +++ b/tests/shell/testcases/optionals/handles_0 @@ -5,4 +5,4 @@ $NFT add table test $NFT add chain test test $NFT add rule test test tcp dport 22 counter accept -$NFT list table test -a | grep 'accept # handle '[[:digit:]]$ >/dev/null +$NFT -a list table test | grep 'accept # handle '[[:digit:]]$ >/dev/null |