]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:26 +0000 (14:03 +0100)
commitf6904ed15ed1a188543057e3cb0d02daa80edfc9
tree24192f9cd9b0be3bc4fb4d41dc97186b043a5a7a
parent87a453f31c636de84420fcce68659abd37d269fd
netfilter: nf_conncount: rework API to use sk_buff directly

[ Upstream commit be102eb6a0e7c03db00e50540622f4e43b2d2844 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.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