Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Antonio Ojea <aojea@google.com>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de
Subject: Re: [PATCH v3 0/2] netfilter: nfqueue: incorrect sctp checksum
Date: Tue, 21 May 2024 12:48:36 +0200	[thread overview]
Message-ID: <Zkx8BCuu6dyTDjcX@calendula> (raw)
In-Reply-To: <CAAdXToQRUiJBzMPGZ7AD_16A-JRZNUrr0aJ20mwaoF7gb92Rqg@mail.gmail.com>

On Mon, May 20, 2024 at 07:59:06PM +0100, Antonio Ojea wrote:
> On Mon, May 20, 2024 at 7:47 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >
> > On Mon, May 20, 2024 at 08:33:39PM +0200, Pablo Neira Ayuso wrote:
> > > On Mon, May 20, 2024 at 05:44:35PM +0200, Pablo Neira Ayuso wrote:
> > > > On Mon, May 20, 2024 at 01:27:22PM +0200, Pablo Neira Ayuso wrote:
> > > > > On Mon, May 13, 2024 at 10:00:31PM +0000, Antonio Ojea wrote:
> > > > > > Fixes the bug described in
> > > > > > https://bugzilla.netfilter.org/show_bug.cgi?id=1742
> > > > > > causing netfilter to drop SCTP packets when using
> > > > > > nfqueue and GSO due to incorrect checksum.
> > > > > >
> > > > > > Patch 1 adds a new helper to process the sctp checksum
> > > > > > correctly.
> > > > > >
> > > > > > Patch 2 adds a selftest regression test.
> > > > >
> > > > > I am inclined to integrated this into nf.git, I will pick a Fixes: tag
> > > > > sufficiently old so -stable picks up.
> > > >
> > > > I have to collapse this chunk, otherwise I hit one issue with missing
> > > > exported symbol. No need to resend, I will amend here. Just for the
> > > > record.
> > >
> > > Hm. SCTP GSO support is different too, because it keeps a list of segments.
> > >
> > > static int
> > > nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
> > > {
> > > [...]
> > >         if ((queue->flags & NFQA_CFG_F_GSO) || !skb_is_gso(skb))
> > >                 return __nfqnl_enqueue_packet(net, queue, entry);
> > >
> > > I think this needs to be:
> > >
> > >         if ((queue->flags & NFQA_CFG_F_GSO) || !skb_is_gso(skb) || !skb_is_gso_sctp(skb))
> >
> > This is not correct either:
> >
> >         if (queue->flags & NFQA_CFG_F_GSO) is true, this also needs !skb_is_gso_sctp(skb)
> >
> > I can see the current selftest disables the NFQA_CFG_F_GSO flag (-G
> > option in nf_queue test program), I suspect that's why this is working.
> >
> 
> I see, so I fixed the bug in one direction and regressed in the other
> one, let me retest both things locallly

The check to force GSO SCTP to be segmented before being sent to
userspace, my proposal:

              if (!skb_is_gso(skb) || ((queue->flags & NFQA_CFG_F_GSO) && !skb_is_gso_sctp(skb)))
                        return __nfqnl_enqueue_packet(net, queue, entry);

              nf_bridge_adjust_skb_data(skb);
              segs = skb_gso_segment(skb, 0);
              ...

and extend selftest to cover for the case where -G is not enabled.

> > >                 return __nfqnl_enqueue_packet(net, queue, entry);
> > >
> > > so SCTP GSO packets enters this path below:
> > >
> > >         nf_bridge_adjust_skb_data(skb);
> > >         segs = skb_gso_segment(skb, 0);
> > >
> > > to deliver separated segments to userspace.
> > >
> > > Otherwise, I don't see yet how userspace can deal with several SCTP
> > > segments, from nf_reinject() there is a list of segments no more.

  reply	other threads:[~2024-05-21 10:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 22:00 [PATCH v3 0/2] netfilter: nfqueue: incorrect sctp checksum Antonio Ojea
2024-05-13 22:00 ` [PATCH v3 1/2] netfilter: nft_queue: compute SCTP checksum Antonio Ojea
2024-05-13 22:18   ` Florian Westphal
2024-05-13 22:00 ` [PATCH v3 2/2] selftests: net: netfilter: nft_queue.sh: sctp checksum Antonio Ojea
2024-05-13 22:18   ` Florian Westphal
2024-05-20 11:27 ` [PATCH v3 0/2] netfilter: nfqueue: incorrect " Pablo Neira Ayuso
2024-05-20 15:44   ` Pablo Neira Ayuso
2024-05-20 18:33     ` Pablo Neira Ayuso
2024-05-20 18:47       ` Pablo Neira Ayuso
2024-05-20 18:59         ` Antonio Ojea
2024-05-21 10:48           ` Pablo Neira Ayuso [this message]
2024-05-21 10:51             ` Florian Westphal
2024-05-21 12:07               ` Pablo Neira Ayuso
2024-05-21 12:48                 ` Florian Westphal
2024-05-21 12:58                   ` Pablo Neira Ayuso
2024-06-02 15:30                     ` Florian Westphal
2024-06-11  8:46                       ` Pablo Neira Ayuso

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=Zkx8BCuu6dyTDjcX@calendula \
    --to=pablo@netfilter.org \
    --cc=aojea@google.com \
    --cc=fw@strlen.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox