]> Gentwo Git Trees - linux/.git/commit
netfilter: nf_conncount: rework API to use sk_buff directly
authorFernando Fernandez Mancera <fmancera@suse.de>
Fri, 21 Nov 2025 00:14:30 +0000 (01:14 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 28 Nov 2025 00:05:49 +0000 (00:05 +0000)
commitbe102eb6a0e7c03db00e50540622f4e43b2d2844
treebf29f4e2afc0b3142f045224475a828c7c17c8e8
parentfe8313316eaf0f3b052d5a9464ca6aa630229400
netfilter: nf_conncount: rework API to use sk_buff directly

When using nf_conncount infrastructure for non-confirmed connections a
duplicated track is possible due to an optimization introduced since
commit d265929930e2 ("netfilter: nf_conncount: reduce unnecessary GC").

In order to fix this introduce a new conncount API that receives
directly an sk_buff struct.  It fetches the tuple and zone and the
corresponding ct from it. It comes with both existing conncount variants
nf_conncount_count_skb() and nf_conncount_add_skb(). In addition remove
the old API and adjust all the users to use the new one.

This way, for each sk_buff struct it is possible to check if there is a
ct present and already confirmed. If so, skip the add operation.

Fixes: d265929930e2 ("netfilter: nf_conncount: reduce unnecessary GC")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack_count.h
net/netfilter/nf_conncount.c
net/netfilter/nft_connlimit.c
net/netfilter/xt_connlimit.c
net/openvswitch/conntrack.c