From 7df42800cf89e994b5179200825592d9b95c5fab Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 4 Jun 2019 12:02:18 +0200 Subject: src: single cache_update() call to build cache before evaluation This patch allows us to make one single cache_update() call. Thus, there is not need to rebuild an incomplete cache from the middle of the batch processing. Note that nft_run_cmd_from_filename() does not need a full netlink dump to build the cache anymore, this should speed nft -f with incremental updates and very large rulesets. cache_evaluate() calculates the netlink dump to populate the cache that this batch needs. Signed-off-by: Pablo Neira Ayuso --- src/mnl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/mnl.c') diff --git a/src/mnl.c b/src/mnl.c index 579210e4..c0df2c94 100644 --- a/src/mnl.c +++ b/src/mnl.c @@ -394,15 +394,9 @@ int mnl_nft_rule_replace(struct netlink_ctx *ctx, const struct cmd *cmd) unsigned int flags = 0; struct nftnl_rule *nlr; struct nlmsghdr *nlh; - int err; - - if (nft_output_echo(&ctx->nft->output)) { - err = cache_update(ctx->nft, CMD_INVALID, ctx->msgs); - if (err < 0) - return err; + if (nft_output_echo(&ctx->nft->output)) flags |= NLM_F_ECHO; - } nlr = nftnl_rule_alloc(); if (!nlr) -- cgit v1.2.3