]> git.karo-electronics.de Git - karo-tx-linux.git/commit
netfilter: nf_tables: add GC synchronization helpers
authorPatrick McHardy <kaber@trash.net>
Thu, 26 Mar 2015 12:39:39 +0000 (12:39 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 1 Apr 2015 09:17:29 +0000 (11:17 +0200)
commit6908665826d56ddd024f3e131a9ee36f0d140943
tree723d477396da1b93c2657e2d35c50a538e411bae
parentcfed7e1b1f8ed9b3d81ab12203cfb69c3ef24ac6
netfilter: nf_tables: add GC synchronization helpers

GC is expected to happen asynchrously to the netlink interface. In the
netlink path, both insertion and removal of elements consist of two
steps, insertion followed by activation or deactivation followed by
removal, during which the element must not be freed by GC.

The synchronization helpers use an unused bit in the genmask field to
atomically mark an element as "busy", meaning it is either currently
being handled through the netlink API or by GC.

Elements being processed by GC will never survive, netlink will simply
ignore them. Elements being currently processed through netlink will be
skipped by GC and reprocessed during the next run.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c