diff options
author | Phil Sutter <phil@nwl.cc> | 2020-01-14 17:25:35 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2020-01-16 16:06:30 +0100 |
commit | 7def18395d118e22a009de7e2e8de7f77906580b (patch) | |
tree | ccb22d162a13238aa4b833f0c2cd5f5be2b8f912 /tests/shell/testcases | |
parent | 68310ba0f9c2066f7463d66a1a1938b66fb8a4c4 (diff) |
cache: Fix for doubled output after reset command
Reset command causes a dump of the objects to reset and adds those to
cache. Yet it ignored if the object in question was already there and up
to now CMD_RESET was flagged as NFT_CACHE_FULL.
Tackle this from two angles: First, reduce cache requirements of reset
command to the necessary bits which is table cache. This alone would
suffice if there wasn't interactive mode (and other libnftables users):
A cache containing the objects to reset might be in place already, so
add dumped objects to cache only if they don't exist already.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell/testcases')
-rwxr-xr-x | tests/shell/testcases/sets/0024named_objects_0 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/shell/testcases/sets/0024named_objects_0 b/tests/shell/testcases/sets/0024named_objects_0 index 3bd16f2f..21200c3c 100755 --- a/tests/shell/testcases/sets/0024named_objects_0 +++ b/tests/shell/testcases/sets/0024named_objects_0 @@ -35,4 +35,14 @@ table inet x { set -e $NFT -f - <<< "$RULESET" -$NFT reset counter inet x user321 +EXPECTED="table inet x { + counter user321 { + packets 12 bytes 1433 + } +}" + +GET="$($NFT reset counter inet x user321)" +if [ "$EXPECTED" != "$GET" ] ; then + $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi |