All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	louis.t42@caramail.com
Subject: Re: [PATCH nf] netfilter: nft_connlimit: fix duplicated tracking of a connection
Date: Mon, 27 Oct 2025 14:47:47 +0100	[thread overview]
Message-ID: <aP94A1HduHkJudgg@strlen.de> (raw)
In-Reply-To: <20251027125730.3864-1-fmancera@suse.de>

Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> Connlimit expression can be used for all kind of packets and not only
> for packets with connection state new. See this ruleset as example:
> 
> table ip filter {
>         chain input {
>                 type filter hook input priority filter; policy accept;
>                 tcp dport 22 ct count over 4 counter
>         }
> }

Right.  Would you mind sending a patch for nftables documentation to
recommend combining this with ct state new or similar?

> +	if (ctinfo == IP_CT_NEW) {
> +		if (nf_conncount_add(nft_net(pkt), priv->list, tuple_ptr, zone)) {
> +			regs->verdict.code = NF_DROP;
> +			return;
> +		}
> +	} else {
> +		local_bh_disable();
> +		nf_conncount_gc_list(nft_net(pkt), priv->list);
> +		local_bh_enable();

LGTM, we could make a __nf_conncount_gc_list and make
nf_conncount_gc_list not need BH disable (and do the jiffies
check first w.o. BH disable) but I think in the interest of
a small patch and given that we should not be dealing with
!new packets anyway I think this change is fine.

Thanks Fernando for fixing this up.

  reply	other threads:[~2025-10-27 13:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 12:57 [PATCH nf] netfilter: nft_connlimit: fix duplicated tracking of a connection Fernando Fernandez Mancera
2025-10-27 13:47 ` Florian Westphal [this message]
2025-10-27 13:54   ` Fernando Fernandez Mancera
2025-10-28 16:58 ` Pablo Neira Ayuso
2025-10-28 17:06   ` Florian Westphal
2025-10-28 17:11     ` Pablo Neira Ayuso
2025-10-28 17:26       ` Florian Westphal
2025-10-28 18:23         ` Fernando Fernandez Mancera
2025-10-28 18:33           ` Florian Westphal
2025-10-28 18:36             ` Fernando Fernandez Mancera
2025-10-28 19:10               ` Florian Westphal
2025-10-28 20:48                 ` Fernando Fernandez Mancera
2025-10-28 20:54                   ` Florian Westphal
2025-10-29  8:03                     ` 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=aP94A1HduHkJudgg@strlen.de \
    --to=fw@strlen.de \
    --cc=coreteam@netfilter.org \
    --cc=fmancera@suse.de \
    --cc=louis.t42@caramail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /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.