With this patch, nft asks the kernel for deleting all rules in a chain.
This replaces the current behaviour that requires to dump all the rules,
then iterate over that list to delete one by one, which is prone to races
and slowier.
After this patch, the following two commands are equivalent:
nft flush chain filter input
nft delete rule filter input
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
int netlink_flush_chain(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc)
{
- return netlink_flush_rules(ctx, h, loc);
+ return netlink_del_rule_batch(ctx, h, loc);
}
int netlink_add_table(struct netlink_ctx *ctx, const struct handle *h,