Check for the index/position in case the echo flag is set on. Set the
NFT_CACHE_UPDATE flag in this case to enable incremental cache updates.

Reported-by: Eric Garver <e...@garver.life>
Fixes: 01e5c6f0ed03 ("src: add cache level flags")
Signed-off-by: Pablo Neira Ayuso <pa...@netfilter.org>
---
 src/cache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cache.c b/src/cache.c
index cffcbb623ced..71d16a0fbeed 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -106,6 +106,9 @@ unsigned int cache_evaluate(struct nft_ctx *nft, struct 
list_head *cmds)
                case CMD_CREATE:
                        if (nft_output_echo(&nft->output)) {
                                flags = NFT_CACHE_FULL;
+                               if (cmd->handle.index.id ||
+                                   cmd->handle.position.id)
+                                       flags |= NFT_CACHE_UPDATE;
                                break;
                        }
                        flags = evaluate_cache_add(cmd, flags);
-- 
2.11.0

Reply via email to