Allow users to enable flow counters via control plane toggle, e.g.
table ip x {
flowtable y {
hook ingress priority 0;
counter;
}
chain z {
type filter hook ingress priority filter;
flow add @z
}
}
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
const char **dev_array;
struct expr *dev_expr;
int dev_array_len;
+ uint32_t flags;
unsigned int refcnt;
};
free(dev_array);
+ nftnl_flowtable_set_u32(flo, NFTNL_FLOWTABLE_FLAGS,
+ cmd->flowtable->flags);
+
netlink_dump_flowtable(flo, ctx);
nlh = nftnl_nlmsg_build_hdr(nftnl_batch_buffer(ctx->batch),
&priority);
flowtable->hooknum =
nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_HOOKNUM);
+ flowtable->flags =
+ nftnl_flowtable_get_u32(nlo, NFTNL_FLOWTABLE_FLAGS);
return flowtable;
}
{
$$->dev_expr = $4;
}
+ | flowtable_block COUNTER
+ {
+ $$->flags |= NFT_FLOWTABLE_COUNTER;
+ }
;
flowtable_expr : '{' flowtable_list_expr '}'
nft_print(octx, ", ");
}
nft_print(octx, " }%s", opts->stmt_separator);
+
+ if (flowtable->flags & NFT_FLOWTABLE_COUNTER)
+ nft_print(octx, "%s%scounter%s", opts->tab, opts->tab,
+ opts->stmt_separator);
}
static void do_flowtable_print(const struct flowtable *flowtable,