@@ -73,7 +73,8 @@ static unsigned int evaluate_cache_del(struct cmd *cmd, unsigned int flags)
{
switch (cmd->obj) {
case CMD_OBJ_ELEMENTS:
- flags |= NFT_CACHE_SETELEM_MAYBE;
+ flags |= NFT_CACHE_SET |
+ NFT_CACHE_SETELEM_MAYBE;
break;
default:
break;
@@ -426,8 +427,7 @@ int nft_cache_evaluate(struct nft_ctx *nft, struct list_head *cmds,
break;
case CMD_DELETE:
case CMD_DESTROY:
- flags |= NFT_CACHE_TABLE |
- NFT_CACHE_SET;
+ flags |= NFT_CACHE_TABLE;
flags = evaluate_cache_del(cmd, flags);
break;
@@ -140,6 +140,10 @@ static int nft_cmd_enoent_set(struct netlink_ctx *ctx, const struct cmd *cmd,
if (!cmd->handle.set.name)
return 0;
+ if (nft_cache_update(ctx->nft, NFT_CACHE_TABLE | NFT_CACHE_SET,
+ ctx->msgs, NULL) < 0)
+ return 0;
+
set = set_lookup_fuzzy(cmd->handle.set.name, &ctx->nft->cache, &table);
/* check table first. */
if (!table)
This is only required to remove elements, relax cache requirements for anything else. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- src/cache.c | 6 +++--- src/cmd.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)