netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
	Neil Horman <nhorman@tuxdriver.com>
Cc: network dev <netdev@vger.kernel.org>,
	netfilter-devel@vger.kernel.org,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Subject: Re: [PATCH net] netfilter: set skb transport_header before calling sctp_compute_cksum
Date: Sat, 9 Mar 2019 17:07:17 +0800	[thread overview]
Message-ID: <CADvbK_djd5ckv3nTROsmHNdr0Z5ULt7MF3MXtNYAO58mo+po7Q@mail.gmail.com> (raw)
In-Reply-To: <20190308155049.by7f4uzjxqnf3xu7@salvia>

On Fri, Mar 8, 2019 at 11:50 PM Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> Hi,
>
> On Sun, Mar 03, 2019 at 04:17:21PM +0800, Xin Long wrote:
> > sctp_hdr(skb) only works when skb->transport_header is set
> > properly.
> >
> > But in the path of nf_conntrack_in:
> >
> >   sctp_packet() -> sctp_error() -> sctp_compute_cksum().
> >
> > skb->transport_header is not guaranteed to be right value
> > for sctp. It will cause to fail to check the checksum for
> > sctp packets.
> >
> > So fix it by setting skb transport_header before calling
> > sctp_compute_cksum().
>
> I see a few more calls to sctp_compute_cksum() in the netfilter tree.
> I guess they are broken too.
>
> In netfilter, skb->transport_header is never set from the input path,
> I think this introduces an assymmetry with other transport protocols.
>
> May we have a variant of sctp_compute_cksum() which does not rely on
> sctp_hdr() instead?
I posted one before this:
  https://marc.info/?l=linux-netdev&m=155109395226858&w=2
But from sctp side, Neil preferred sctp_hdr().

We need to either add skb_set_transport_header() in sctp_s/dnat_handler()
and sctp_manip_pkt(), or bring that patch back?

Now it seems not good to set skb->transport_header in netfilter code.
Hi Neil, what's your point now?

  reply	other threads:[~2019-03-09  9:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-03  8:17 [PATCH net] netfilter: set skb transport_header before calling sctp_compute_cksum Xin Long
2019-03-08 15:50 ` Pablo Neira Ayuso
2019-03-09  9:07   ` Xin Long [this message]
2019-03-09  9:24     ` Florian Westphal
2019-03-11 11:07       ` Neil Horman
2019-03-12  8:39         ` Xin Long
2019-03-12  9:48           ` Pablo Neira Ayuso
2019-03-12 11:01             ` Xin Long

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=CADvbK_djd5ckv3nTROsmHNdr0Z5ULt7MF3MXtNYAO58mo+po7Q@mail.gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).