All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4 nf-next v2] netfilter: rework conncount API to receive ct directly
@ 2025-11-10 15:42 Fernando Fernandez Mancera
  2025-11-10 15:42 ` [PATCH 1/4 nf-next v2] netfilter: conntrack: add nf_ct_get_or_find() helper Fernando Fernandez Mancera
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Fernando Fernandez Mancera @ 2025-11-10 15:42 UTC (permalink / raw)
  To: netfilter-devel
  Cc: coreteam, pablo, fw, phil, aconole, echaudro, i.maximets,
	Fernando Fernandez Mancera

This series is fixing two different problems. The first issue is related
to duplicated entries when used for non-confirmed connections in
nft_connlimit and xt_connlimit. Now, nf_conncount_add() checks whether
the connection is confirmed or not. If the connection is confirmed,
skip the add.

In order to do that, the nf_conncount API is now receiving struct nf_conn
as argument instead of tuple and zone. In addition, nf_conncount_count()
also needs to receive the net because it calls nf_conncount_gc_list()
inside it if ct is NULL.

The second issue this series is fixing is related to
nft_connlimit/xt_connlimit not updating the list of connection for
confirmed connections breaking softlimiting use-cases like limiting the
bandwidth when too many connections are open.

This has been tested on datapath using connlimit in nftables and
iptables. I have stressed the system up to 2000 connections.

CC'ing openvswitch maintainers as this change on the API required me to
touch their code. I am not very familiar with the internals of
openvswitch but I believe this should be fine for them as they hold a
reference to a valid ct already. If you could provide some testing from
openvswitch side it would be really helpful.

Fernando Fernandez Mancera (4):
  netfilter: conntrack: add nf_ct_get_or_find() helper
  netfilter: nf_conncount: only track connection if it is not confirmed
  netfilter: nf_conncount: make nf_conncount_gc_list() to disable BH
  netfilter: nft_connlimit: update connection list if add was skipped

 include/net/netfilter/nf_conntrack.h       |  3 +
 include/net/netfilter/nf_conntrack_count.h | 10 +--
 net/netfilter/nf_conncount.c               | 94 +++++++++++++---------
 net/netfilter/nf_conntrack_core.c          | 35 ++++++++
 net/netfilter/nft_connlimit.c              | 45 ++++++-----
 net/netfilter/xt_connlimit.c               | 27 +++----
 net/openvswitch/conntrack.c                | 14 ++--
 7 files changed, 133 insertions(+), 95 deletions(-)

-- 
2.51.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-11-10 21:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 15:42 [PATCH 0/4 nf-next v2] netfilter: rework conncount API to receive ct directly Fernando Fernandez Mancera
2025-11-10 15:42 ` [PATCH 1/4 nf-next v2] netfilter: conntrack: add nf_ct_get_or_find() helper Fernando Fernandez Mancera
2025-11-10 15:42 ` [PATCH 2/4 nf-next v2] netfilter: nf_conncount: only track connection if it is not confirmed Fernando Fernandez Mancera
2025-11-10 20:44   ` Florian Westphal
2025-11-10 21:40     ` Fernando Fernandez Mancera
2025-11-10 15:42 ` [PATCH 3/4 nf-next v2] netfilter: nf_conncount: make nf_conncount_gc_list() to disable BH Fernando Fernandez Mancera
2025-11-10 15:42 ` [PATCH 4/4 nf-next v2] netfilter: nft_connlimit: update connection list if add was skipped Fernando Fernandez Mancera

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.