All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Allen Simpson <william.allen.simpson@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Linux Kernel Developers" <linux-kernel@vger.kernel.org>,
	"Linux Kernel Network Developers" <netdev@vger.kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>,
	"Andi Kleen" <andi@firstfloor.org>
Subject: Re: [PATCH] tcp: harmonize tcp_vx_rcv header length assumptions
Date: Wed, 13 Jan 2010 04:50:12 -0500	[thread overview]
Message-ID: <4B4D9754.9070902@gmail.com> (raw)
In-Reply-To: <4B4CAD45.5080606@gmail.com>

William Allen Simpson wrote:
> Eric Dumazet wrote:
>> Seems fine, but :
>>
>> 1) What means the "Transformed ?" you wrote several times ?
>>
> The only reason that I've been able to figure out for having the
> skb->len test in those places is the preceding xfrm4_policy_check()
> or xfrm6_policy_check() must be able to shrink the skb->len?
> 
> When I did the original transform stuff in other code circa 1995, I'd
> envisioned IP length or link layer (PPP) length shrinking (removing
> padding after block ciphers) -- and apparently this implementation
> extended that concept to transport layer, too.
> 
> Personally, I'd prefer that a single test be placed in the appropriate
> spot in the xfrm* functions, instead.  Anybody know where?
> 
I've spent another day staring at the xfrm* functions.  Since nobody
familiar with them has answered my recent questions, it seems I'm on my
own....  So, here are my conclusions:

The current xfrm* code shouldn't change the TCP header.  If anything did,
the current tests wouldn't work anyway.  For example:

tcp_ipv4:
tcp_v4_rcv()
...
1645 no_tcp_socket:
1646         if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1647                 goto discard_it;
1648
1649         if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {

This code depends on the *th pointer remaining unchanged.  A pullup or
skb clone could make the pointer invalid.

Likewise, the checksum occurs after the xfrm* code.  Thus, the xfrm*
cannot alter, decrypt, or tunnel the input data.

Therefore, I'll remove those existing extraneous skb->len tests.  And
I'll add these criteria to the include/net/xfrm.h for future reference.

  reply	other threads:[~2010-01-13  9:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-10 13:02 query: redundant tcp header length checks? William Allen Simpson
2010-01-12 10:05 ` [PATCH] tcp: harmonize tcp_vx_rcv header length assumptions William Allen Simpson
2010-01-12 10:46   ` Eric Dumazet
2010-01-12 17:11     ` William Allen Simpson
2010-01-13  9:50       ` William Allen Simpson [this message]
2010-01-12 17:14     ` William Allen Simpson
2010-01-13 10:48 ` [PATCH v4] " William Allen Simpson
2010-01-13 11:56   ` Andi Kleen
2010-01-13 15:36     ` William Allen Simpson
2010-01-13 15:53       ` Andi Kleen
2010-01-13 16:40         ` [PATCH] Makefile: Document ability to make file.lst and file.S Joe Perches
2010-01-13 17:14           ` Andi Kleen
2010-01-13 17:31             ` Joe Perches
2010-01-13 19:51               ` William Allen Simpson
2010-01-14  3:26               ` Américo Wang
2010-01-14  3:26                 ` Américo Wang
2010-01-18 12:29               ` Michal Marek
2010-01-13 19:49         ` [PATCH v4] tcp: harmonize tcp_vx_rcv header length assumptions William Allen Simpson
2010-01-13 20:19           ` Andi Kleen
2010-01-13 21:13           ` William Allen Simpson
2010-01-14  1:03             ` Joe Perches
2010-01-14  8:39               ` Patrick McHardy
2010-01-14 15:02                 ` William Allen Simpson
2010-01-14 15:10 ` [PATCH v5] " William Allen Simpson

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=4B4D9754.9070902@gmail.com \
    --to=william.allen.simpson@gmail.com \
    --cc=andi@firstfloor.org \
    --cc=eric.dumazet@gmail.com \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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.