goto out;
}
+ if (nft_output_echo(&monh->ctx->nft->output) &&
+ !set_is_anonymous(s->flags)) {
+ set_free(s);
+ goto out;
+ }
+
set_add_hash(s, t);
out:
nftnl_set_free(nls);
goto out;
}
+ if (nft_output_echo(&monh->ctx->nft->output) &&
+ !set_is_anonymous(set->flags))
+ goto out;
+
nlsei = nftnl_set_elems_iter_create(nls);
if (nlsei == NULL)
memory_allocation_error();
static void netlink_events_cache_update(struct netlink_mon_handler *monh,
const struct nlmsghdr *nlh, int type)
{
- if (!monh->cache_needed)
+ if (nft_output_echo(&monh->ctx->nft->output) &&
+ type != NFT_MSG_NEWSET && type != NFT_MSG_NEWSETELEM)
return;
switch (type) {
return 0;
}
-static bool need_cache(const struct cmd *cmd)
-{
- /*
- * - new rules in default format
- * - new elements
- */
- if (((cmd->monitor->flags & (1 << NFT_MSG_NEWRULE)) &&
- (cmd->monitor->format == NFTNL_OUTPUT_DEFAULT)) ||
- (cmd->monitor->flags & (1 << NFT_MSG_NEWSETELEM)))
- return true;
-
- if (cmd->monitor->flags & (1 << NFT_MSG_TRACE))
- return true;
-
- return false;
-}
-
static int do_command_monitor(struct netlink_ctx *ctx, struct cmd *cmd)
{
struct netlink_mon_handler monhandler = {
if (nft_output_json(&ctx->nft->output))
monhandler.format = NFTNL_OUTPUT_JSON;
- monhandler.cache_needed = need_cache(cmd);
-
return netlink_monitor(&monhandler, ctx->nft->nf_sock);
}