extern int cache_update(struct mnl_socket *nf_sock, struct nft_cache *cache,
enum cmd_ops cmd, struct list_head *msgs, unsigned int debug_flag,
struct output_ctx *octx);
-extern void cache_flush(struct list_head *table_list);
+extern void cache_flush(struct mnl_socket *nf_sock, struct nft_cache *cache,
+ enum cmd_ops cmd, struct list_head *msgs,
+ unsigned int debug_mask, struct output_ctx *octx);
extern void cache_release(struct nft_cache *cache);
enum udata_type {
switch (cmd->obj) {
case CMD_OBJ_RULESET:
- cache_flush(&ctx->cache->list);
+ cache_flush(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
+ ctx->debug_mask, ctx->octx);
break;
case CMD_OBJ_TABLE:
/* Flushing a table does not empty the sets in the table nor remove
return 0;
}
-void cache_flush(struct list_head *table_list)
+static void __cache_flush(struct list_head *table_list)
{
struct table *table, *next;
}
}
+void cache_flush(struct mnl_socket *nf_sock, struct nft_cache *cache,
+ enum cmd_ops cmd, struct list_head *msgs,
+ unsigned int debug_mask, struct output_ctx *octx)
+{
+ struct netlink_ctx ctx = {
+ .list = LIST_HEAD_INIT(ctx.list),
+ .nf_sock = nf_sock,
+ .cache = cache,
+ .msgs = msgs,
+ .debug_mask = debug_mask,
+ .octx = octx,
+ };
+
+ __cache_flush(&cache->list);
+ cache->genid = netlink_genid_get(&ctx);
+}
+
void cache_release(struct nft_cache *cache)
{
- cache_flush(&cache->list);
+ __cache_flush(&cache->list);
cache->genid = 0;
}