diff options
author | Phil Sutter <phil@nwl.cc> | 2018-03-19 18:02:02 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-03-20 13:05:43 +0100 |
commit | 935f82e7dd4911fde6be9dae960fd1d438542a5d (patch) | |
tree | 453d7db9f6663137d704e60c52f3b31b0140bf40 /tests/shell/testcases/nft-f/0007action_object_set_segfault_1 | |
parent | 4aba100e593f28105be300dc888935fad5dc822f (diff) |
Support 'nft -f -' to read from stdin
In libnftables, detect if given filename is '-' and treat it as the
common way of requesting to read from stdin, then open /dev/stdin
instead. (Calling 'nft -f /dev/stdin' worked before as well, but this
makes it official.)
With this in place and bash's support for here strings, review all tests
in tests/shell for needless use of temp files. Note that two categories
of test cases were intentionally left unchanged:
- Tests creating potentially large rulesets to avoid running into shell
parameter length limits.
- Tests for 'include' directive for obvious reasons.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases/nft-f/0007action_object_set_segfault_1')
-rwxr-xr-x | tests/shell/testcases/nft-f/0007action_object_set_segfault_1 | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 b/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 index 3a4183bb..7649a496 100755 --- a/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 +++ b/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 @@ -3,19 +3,11 @@ # test for a segfault if bad syntax was used in set declaration # and the set is referenced in the same batch -tmpfile=$(mktemp) -if [ ! -w $tmpfile ] ; then - echo "Failed to create tmp file" >&2 - exit 0 -fi - -trap "rm -f $tmpfile" EXIT # cleanup if aborted - -echo " +RULESET=" add table t add chain t c add set t s {type ipv4_addr\;} add rule t c ip saddr @s -" > $tmpfile +" -$NFT -f $tmpfile 2>/dev/null +$NFT -f - <<< $RULESET 2>/dev/null |