This function might be useful to recycle the existing nft_ctx to use it
with different external variable definitions.
Moreover, reset ctx->num_vars to zero.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
void nft_ctx_clear_include_paths(struct nft_ctx *ctx);
int nft_ctx_add_var(struct nft_ctx *ctx, const char *var);
+void nft_ctx_clear_vars(struct nft_ctx *ctx);
int nft_run_cmd_from_buffer(struct nft_ctx *nft, const char *buf);
int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename);
return 0;
}
-static void nft_ctx_clear_vars(struct nft_ctx *ctx)
+EXPORT_SYMBOL(nft_ctx_clear_vars);
+void nft_ctx_clear_vars(struct nft_ctx *ctx)
{
unsigned int i;
xfree(ctx->vars[i].key);
xfree(ctx->vars[i].value);
}
+ ctx->num_vars = 0;
xfree(ctx->vars);
}
LIBNFTABLES_2 {
nft_ctx_add_var;
+ nft_ctx_clear_vars;
} LIBNFTABLES_1;