All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>,
	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: Tue, 28 Oct 2025 18:26:47 +0100	[thread overview]
Message-ID: <aQD810keSBweNG66@strlen.de> (raw)
In-Reply-To: <aQD5PUkG7M_sqUAv@calendula>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Tue, Oct 28, 2025 at 06:06:47PM +0100, Florian Westphal wrote:
> > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > -	if (nf_conncount_add(nft_net(pkt), priv->list, tuple_ptr, zone)) {
> > > > -		regs->verdict.code = NF_DROP;
> > > > -		return;
> > > > +	if (ctinfo == IP_CT_NEW) {
> > > 
> > > Quick question: Is this good enough to deal with retransmitted packets
> > > while in NEW state?
> > 
> > Good point, I did not consider retransmit case.
> > What about if (!nf_ct_is_confirmed(ct)) { ..?
> > 
> > Would need a small comment that this is there instead of NEW
> > check due to rexmit.
> > 
> > > > +		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();
> > > >  	}
> > 
> > As this needs a respin anyway, what about removing the else
> > clause altogether?  Resp. what was the rationale for doing a gc call
> > here?
> 
> You mean, call gc for both cases, correct?

No, i meant this:

/* comment that explains this */
if (nf_ct_is_confirmed(ct))
	return;

if (nf_conncount_add(nft_net(pkt), priv->list, tuple_ptr, zone)) {
	regs->verdict.code = NF_DROP;
	return;
}

As we don't add anything for 'is confirmed' case, I don't see why
we would need to prune the existing list.

> > And, do we want same check in xt_connlimit?
> 
> Are you referring to the !nf_ct_is_confirmed() check?

Yes, AFAICS xt_connlimit has same issue as nft_conncount given
they use same backend.

Backend doesn't have access to nf_conn/ctinfo so no way to solve it there.

  reply	other threads:[~2025-10-28 17:26 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
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 [this message]
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=aQD810keSBweNG66@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 \
    --cc=pablo@netfilter.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.