]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: support for recursive chain deletion
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 3 Sep 2017 21:56:01 +0000 (23:56 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 4 Sep 2017 15:34:55 +0000 (17:34 +0200)
commitf7dd3828e0cb96637e1420587ee202dda846f479
treeb4ec2c6a0e33a1c05a6139b160310b3ad70e1d7e
parent9d235a78c67c54e545382b75e198d4f6b759a5f4
netfilter: nf_tables: support for recursive chain deletion

This patch sorts out an asymmetry in deletions. Currently, table and set
deletion commands come with an implicit content flush on deletion.
However, chain deletion results in -EBUSY if there is content in this
chain, so no implicit flush happens. So you have to send a flush command
in first place to delete chains, this is inconsistent and it can be
annoying in terms of user experience.

This patch uses the new NLM_F_NONREC flag to request non-recursive chain
deletion, ie. if the chain to be removed contains rules, then this
returns EBUSY. This problem was discussed during the NFWS'17 in Faro,
Portugal. In iptables, you hit -EBUSY if you try to delete a chain that
contains rules, so you have to flush first before you can remove
anything. Since iptables-compat uses the nf_tables netlink interface, it
has to use the NLM_F_NONREC flag from userspace to retain the original
iptables semantics, ie.  bail out on removing chains that contain rules.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c