netfilter: nf_tables: wrap tracing with a static key
authorFlorian Westphal <fw@strlen.de>
Sat, 28 Nov 2015 20:53:05 +0000 (21:53 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 9 Dec 2015 12:23:13 +0000 (13:23 +0100)
commite639f7ab079b5256660018511d87aa34b54f1a9d
tree09f266f4a2ad558dced74ac4287a3277cccdc6be
parent33d5a7b14bfd02e60af9d223db8dfff0cbcabe6b
netfilter: nf_tables: wrap tracing with a static key

Only needed when meta nftrace rule(s) were added.
The assumption is that no such rules are active, so the call to
nft_trace_init is "never" needed.

When nftrace rules are active, we always call the nft_trace_* functions,
but will only send netlink messages when all of the following are true:

 - traceinfo structure was initialised
 - skb->nf_trace == 1
 - at least one subscriber to trace group.

Adding an extra conditional
(static_branch ... && skb->nf_trace)
nft_trace_init( ..)

Is possible but results in a larger nft_do_chain footprint.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables_core.h
include/net/netfilter/nft_meta.h
net/bridge/netfilter/nft_meta_bridge.c
net/netfilter/nf_tables_core.c
net/netfilter/nf_tables_trace.c
net/netfilter/nft_meta.c