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,
	phil@nwl.cc, fw@strlen.de
Subject: Re: [PATCH 3/3 nf v5] netfilter: xtables: fix L4 header parsing for non-first fragments
Date: Thu, 30 Apr 2026 17:06:58 +0200	[thread overview]
Message-ID: <afNwEgYpHBARCaI3@chamomile> (raw)
In-Reply-To: <236f1674-6ed2-4822-b313-3835c5895af7@suse.de>

On Thu, Apr 30, 2026 at 04:53:14PM +0200, Fernando Fernandez Mancera wrote:
> On 4/30/26 8:08 AM, Pablo Neira Ayuso wrote:
> > Hi Fernando,
> > 
> > On Tue, Apr 28, 2026 at 12:25:48PM +0200, Fernando Fernandez Mancera wrote:
> > > Multiple targets and matches relies on L4 header to operate. For
> > > fragmented packets, every fragment carries the transport protocol
> > > identifier, but only the first fragment contains the L4 header.
> > > 
> > > As the 'raw' table can be configured to run at priority -450 (before
> > > defragmentation at -400), the target/match can be reached before
> > > reassembly. In this case, non-first fragments have their payload
> > > incorrectly parsed as a TCP/UDP header. This would be of course a
> > > misconfiguration scenario. In most of the cases this just lead to a
> > > unreliable behavior for fragmented traffic.
> > > 
> > > Add a fragment check to ensure target/match only evaluates unfragmented
> > > packets or the first fragment in the stream.
> > 
> > One more little issue here: There seems to be an issue in
> > xt_hashlimit, hashlimit_init_dst() drops packets via hotdrop if it
> > returns -1.
> 
> Hi Pablo, I do not follow here. I think a hotdrop is the right thing to do.
> 
> xt_hashlimit creates the hash and later checks whether we are over the limit
> or not. The verdict is set based on that and the INVERT flag.. I don't think
> we should match or not match packets that we cannot parse correctly, we
> should just drop them.
> 
> This is the current behavior for example when protoff < 0 (because no L4
> header is found).
> 
> What do you think?

Your reasoning makes sense.

Currently if protoff < 0, the packet is dropped, therefore, fragments
are already being dropped.

Let's stick to this approach, thanks for explaining. I will take this
series as is then.

      reply	other threads:[~2026-04-30 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 10:25 [PATCH 1/3 nf v5] netfilter: nf_socket: skip socket lookup for non-first fragments Fernando Fernandez Mancera
2026-04-28 10:25 ` [PATCH 2/3 nf v5] netfilter: nf_tables: skip L4 header parsing " Fernando Fernandez Mancera
2026-04-28 10:25 ` [PATCH 3/3 nf v5] netfilter: xtables: fix " Fernando Fernandez Mancera
2026-04-30  6:08   ` Pablo Neira Ayuso
2026-04-30 14:53     ` Fernando Fernandez Mancera
2026-04-30 15:06       ` Pablo Neira Ayuso [this message]

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=afNwEgYpHBARCaI3@chamomile \
    --to=pablo@netfilter.org \
    --cc=coreteam@netfilter.org \
    --cc=fmancera@suse.de \
    --cc=fw@strlen.de \
    --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.