netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam Langley" <agl@imperialviolet.org>
To: "James Morris" <jmorris@namei.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] Fix corrupt TCP packets when options space overflows with MD5SIG enabled
Date: Tue, 3 Jun 2008 09:31:02 -0700	[thread overview]
Message-ID: <396556a20806030931s9e8ec42hba9e39d9fe3514f1@mail.gmail.com> (raw)
In-Reply-To: <Xine.LNX.4.64.0806020938240.8594@us.intercode.com.au>

On Sun, Jun 1, 2008 at 4:40 PM, James Morris <jmorris@namei.org> wrote:
> Reviewed-by: James Morris <jmorris@namei.org>


Looking at this code some more, I fear that I've fucked up that patch.
The logic for TCP options seems to be duplicated three times in the
code: the size calculation (patched), the building of the actual
options (tcp_build_and_update_options / tcp_syn_build_options) and the
MSS calculations (tcp_current_mss).

It looks, on second glance, that this code in
tcp_build_and_update_options will include the options even though we
calculated the size without:

if (tp->rx_opt.eff_sacks) {
	struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack :
tp->selective_acks;
	int this_sack;

	*ptr++ = htonl((TCPOPT_NOP  << 24) |
		       (TCPOPT_NOP  << 16) |
		       (TCPOPT_SACK <<  8) |
		       (TCPOLEN_SACK_BASE + (tp->rx_opt.eff_sacks *
			     TCPOLEN_SACK_PERBLOCK)));
...

Unless I'm missing something, that patch was incomplete and we're
still sending invalid packets on in the MD5SIG + SACK case.

If so, I'll try and get the other two cases with another patch.

Additionally, it would appear that it would be useful to pull this
logic into a single place: maybe a function which runs multiple times
(to calculate the MSS / header size and a second time to actually
perform the options writes). But that'll be a different patch.

Cheers,

AGL

-- 
Adam Langley agl@imperialviolet.org http://www.imperialviolet.org

  parent reply	other threads:[~2008-06-03 16:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 18:40 [PATCH] Fix corrupt TCP packets when options space overflows with MD5SIG enabled Adam Langley
2008-05-30 19:02 ` Ben Hutchings
2008-05-30 19:11   ` Adam Langley
2008-05-30 19:17     ` Adam Langley
2008-05-30 20:32       ` Stephen Hemminger
2008-05-31 22:01         ` Adam Langley
2008-05-31 21:57 ` Adam Langley
2008-06-01 23:40   ` James Morris
2008-06-02  6:56     ` David Miller
2008-06-03 16:31     ` Adam Langley [this message]
2008-06-03 16:44       ` David Miller

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=396556a20806030931s9e8ec42hba9e39d9fe3514f1@mail.gmail.com \
    --to=agl@imperialviolet.org \
    --cc=jmorris@namei.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 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).