netfilter: prefer extension check to pointer check
authorFlorian Westphal <fw@strlen.de>
Mon, 25 Apr 2022 13:15:44 +0000 (15:15 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 13 May 2022 16:56:28 +0000 (18:56 +0200)
commit8edc813111001e9be3cce066d3d4091d2ef04a1d
tree178f82135ed388c543d2853de79635b1eda253ab
parent90d1daa45849f272b701f29d6ca88b24743c7553
netfilter: prefer extension check to pointer check

The pointer check usually results in a 'false positive': its likely
that the ctnetlink module is loaded but no event monitoring is enabled.

After recent change to autodetect ctnetlink usage and only allocate
the ecache extension if a listener is active, check if the extension
is present on a given conntrack.

If its not there, there is nothing to report and calls to the
notification framework can be elided.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack_core.h
include/net/netfilter/nf_conntrack_ecache.h