Introduce a function to distinguish which command object was given and
request only the necessary bits to have sets and their elements
available for 'get element' command.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
return flags;
}
+static unsigned int evaluate_cache_get(struct cmd *cmd, unsigned int flags)
+{
+ switch (cmd->obj) {
+ case CMD_OBJ_SETELEM:
+ flags |= NFT_CACHE_TABLE |
+ NFT_CACHE_SET |
+ NFT_CACHE_SETELEM;
+ break;
+ default:
+ break;
+ }
+
+ return flags;
+}
+
static unsigned int evaluate_cache_flush(struct cmd *cmd, unsigned int flags)
{
switch (cmd->obj) {
flags = evaluate_cache_del(cmd, flags);
break;
case CMD_GET:
+ flags = evaluate_cache_get(cmd, flags);
+ break;
case CMD_LIST:
case CMD_RESET:
case CMD_EXPORT: