Currently:
nft -c reset rules ip x
ignores -c/--check.
The reset and list commands use the netlink GET/DUMP nfnetlink API which
provides no check semantics, compared to the NEW/DELETE nfnetlink batch
API which indeed does.
Emulate -c/--check for the reset command by handling this as a list
command, so the state of the objects is just listed, not reset. This
allows to check for presence and dump the content of the objects.
Fixes: dbff26bfba83 ("cache: consolidate reset command")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
flags = evaluate_cache_get(cmd, flags);
break;
case CMD_RESET:
- flags = evaluate_cache_reset(cmd, flags, filter);
+ if (nft->check)
+ flags = evaluate_cache_list(nft, cmd, flags, filter);
+ else
+ flags = evaluate_cache_reset(cmd, flags, filter);
break;
case CMD_LIST:
flags = evaluate_cache_list(nft, cmd, flags, filter);