diff options
author | Phil Sutter <phil@nwl.cc> | 2023-12-15 01:10:39 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2024-04-19 19:21:21 +0200 |
commit | 4955ae1a81b73f9a61b7fbf1a73e11544513548e (patch) | |
tree | 7883c0cd9e049bdb80d7694a174d31ee3b44a278 /tests/shell | |
parent | 83ed57d587afb248dc5dc72006b247319193008d (diff) |
Add support for table's persist flag
Bison parser lacked support for passing multiple flags, JSON parser
did not support table flags at all.
Document also 'owner' flag (and describe their relationship in nft.8.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/shell')
-rw-r--r-- | tests/shell/features/table_flag_persist.nft | 3 | ||||
-rwxr-xr-x | tests/shell/testcases/owner/0002-persist | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/shell/features/table_flag_persist.nft b/tests/shell/features/table_flag_persist.nft new file mode 100644 index 00000000..0da3e6d4 --- /dev/null +++ b/tests/shell/features/table_flag_persist.nft @@ -0,0 +1,3 @@ +table t { + flags persist; +} diff --git a/tests/shell/testcases/owner/0002-persist b/tests/shell/testcases/owner/0002-persist new file mode 100755 index 00000000..cf4b8f13 --- /dev/null +++ b/tests/shell/testcases/owner/0002-persist @@ -0,0 +1,36 @@ +#!/bin/bash + +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_table_flag_owner) +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_table_flag_persist) + +die() { + echo "$@" + exit 1 +} + +$NFT -f - <<EOF +table ip t { + flags owner, persist +} +EOF +[[ $? -eq 0 ]] || { + die "table add failed" +} + +$NFT list ruleset | grep -q 'table ip t' || { + die "table does not persist" +} +$NFT list ruleset | grep -q 'flags persist$' || { + die "unexpected flags in orphaned table" +} + +$NFT -f - <<EOF +table ip t { + flags owner, persist +} +EOF +[[ $? -eq 0 ]] || { + die "retake ownership failed" +} + +exit 0 |