All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	fw@strlen.de, phil@nwl.cc, aconole@redhat.com,
	echaudro@redhat.com, i.maximets@ovn.org
Subject: Re: [PATCH 0/6 nf-next v3] netfilter: rework conncount API to receive sk_buff directly
Date: Fri, 21 Nov 2025 00:43:18 +0100	[thread overview]
Message-ID: <aR-nlkm8RrHZsCbP@calendula> (raw)
In-Reply-To: <20251112114351.3273-2-fmancera@suse.de>

Hi Fernando,

On Wed, Nov 12, 2025 at 12:43:46PM +0100, Fernando Fernandez Mancera wrote:
> 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, nf_conncount_count_skb() and nf_conncount_add_skb()
> API has been introduced. They allow the user to pass the sk_buff
> directly. The old API has been removed.
> 
> 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 with nftables and iptables both in filter and raw
> priorities. 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. If you could provide some
> testing from openvswitch side it would be really helpful.
> 
> Fernando Fernandez Mancera (6):
>   netfilter: nf_conncount: introduce new nf_conncount_count_skb() API
>   netfilter: xt_connlimit: use nf_conncount_count_skb() directly
>   openvswitch: use nf_conncount_count_skb() directly
>   netfilter: nf_conncount: pass the sk_buff down to __nf_conncount_add()

I have collapsed this four patches initial patches (1-4) to see how it
looks:

 include/net/netfilter/nf_conntrack_count.h |   17 ++++-----
 net/netfilter/nf_conncount.c               |  159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
 net/netfilter/nft_connlimit.c              |   21 +----------
 net/netfilter/xt_connlimit.c               |   14 +------
 net/openvswitch/conntrack.c                |   16 ++++----
 5 files changed, 133 insertions(+), 94 deletions(-)

It is a bit large, but I find it easier to understand the goal,
because this patch is pushing down the skb into the conncount core and
adapting callers at the same time, which is what Florian suggested.

Then, another patch to add the special -EINVAL case for already
confirmed conntracks that is in patch 6/6 in this series. This is to
deal with the new use-case of using ct count really for counting, not
just for limiting.

Finally, the gc consolidation.

I pushed it to this branch in nf-next.git,

        https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git/log/?h=tentative-conncount-series

NOTE: commit messages would need an adjustment.

Sidenote: Not related, but connlimit does not work for bridge and
netdev families because of nft_pf(). This relates to another topic
that is being discussing about how to handle vlan/pppoe packets.
**No need to address this series**, just mentioning it.

  parent reply	other threads:[~2025-11-20 23:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 11:43 [PATCH 0/6 nf-next v3] netfilter: rework conncount API to receive sk_buff directly Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 1/6 nf-next v3] netfilter: nf_conncount: introduce new nf_conncount_count_skb() API Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 2/6 nf-next v3] netfilter: xt_connlimit: use nf_conncount_count_skb() directly Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 3/6 nf-next v3] openvswitch: " Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 4/6 nf-next v3] netfilter: nf_conncount: pass the sk_buff down to __nf_conncount_add() Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 5/6 nf-next v3] netfilter: nf_conncount: make nf_conncount_gc_list() to disable BH Fernando Fernandez Mancera
2025-11-12 11:43 ` [PATCH 6/6 nf-next v3] netfilter: nft_connlimit: update the count if add was skipped Fernando Fernandez Mancera
2025-11-20 23:43 ` Pablo Neira Ayuso [this message]
2025-11-21  0:16   ` [PATCH 0/6 nf-next v3] netfilter: rework conncount API to receive sk_buff directly Fernando Fernandez Mancera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aR-nlkm8RrHZsCbP@calendula \
    --to=pablo@netfilter.org \
    --cc=aconole@redhat.com \
    --cc=coreteam@netfilter.org \
    --cc=echaudro@redhat.com \
    --cc=fmancera@suse.de \
    --cc=fw@strlen.de \
    --cc=i.maximets@ovn.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.