From 7def18395d118e22a009de7e2e8de7f77906580b Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 14 Jan 2020 17:25:35 +0100 Subject: 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 Acked-by: Pablo Neira Ayuso --- src/cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cache.c') diff --git a/src/cache.c b/src/cache.c index 0c28a28d..05f0d68e 100644 --- a/src/cache.c +++ b/src/cache.c @@ -138,8 +138,10 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct list_head *cmds) case CMD_GET: flags = evaluate_cache_get(cmd, flags); break; - case CMD_LIST: case CMD_RESET: + flags |= NFT_CACHE_TABLE; + break; + case CMD_LIST: case CMD_EXPORT: case CMD_MONITOR: flags |= NFT_CACHE_FULL; -- cgit v1.2.3