netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Bijay Singh" <Bijay.Singh@guavus.com>,
	"David Miller" <davem@davemloft.net>,
	"<bhaskie@gmail.com>" <bhaskie@gmail.com>,
	"<bhutchings@solarflare.com>" <bhutchings@solarflare.com>,
	netdev <netdev@vger.kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Subject: Re: TCP-MD5 checksum failure on x86_64 SMP
Date: Mon, 17 May 2010 13:42:40 -0700	[thread overview]
Message-ID: <20100517134240.1949f245@nehalam> (raw)
In-Reply-To: <1274072629.2299.58.camel@edumazet-laptop>

On Mon, 17 May 2010 07:03:49 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le lundi 17 mai 2010 à 03:49 +0000, Bijay Singh a écrit :
> 
> > I am on quite an old kernel 2.6.27 and could not apply your patches.
> > 
> > Then i moved on to the kernel 2.6.32.11 however since then I have not been able to bring up my card, this is something i need to fix before i can test you fix. Working on that.
> > 
> 
> Thanks again for the status report.
> 
> I see bug is older than what I stated in my previous mail
> 
> I could reproduce it in my lab and confirm following patch fixes it
> 
> This is a stable candidate (2.6.27 kernels)
> 
> Thanks
> 
> [PATCH] tcp: tcp_synack_options() fix 
> 
> Commit 33ad798c924b4a (tcp: options clean up) introduced a problem
> if MD5+SACK+timestamps were used in initial SYN message.
> 
> Some stacks (old linux for example) try to negotiate MD5+SACK+TSTAMP
> sessions, but since 20 bytes of tcp options space are not enough to
> store all the bits needed, we chose to disable timestamps in this case.
> 
> We send a SYN-ACK _without_ timestamp option, but socket has timestamps
> enabled and all further outgoing messages contain a TS block, all with
> the initial timestamp of the remote peer.
> 
> Fix is to really disable timestamps option for the whole session.
> 
> Reported-by: Bijay Singh <Bijay.Singh@guavus.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  net/ipv4/tcp_output.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 0dda86e..b8bb226 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -667,7 +667,7 @@ static unsigned tcp_synack_options(struct sock *sk,
>  	u8 cookie_plus = (xvp != NULL && !xvp->cookie_out_never) ?
>  			 xvp->cookie_plus :
>  			 0;
> -	bool doing_ts = ireq->tstamp_ok;
> +	bool doing_ts;
>  
>  #ifdef CONFIG_TCP_MD5SIG
>  	*md5 = tcp_rsk(req)->af_specific->md5_lookup(sk, req);
> @@ -680,11 +680,12 @@ static unsigned tcp_synack_options(struct sock *sk,
>  		 * rather than TS in order to fit in better with old,
>  		 * buggy kernels, but that was deemed to be unnecessary.
>  		 */
> -		doing_ts &= !ireq->sack_ok;
> +		ireq->tstamp_ok &= !ireq->sack_ok;
>  	}
>  #else
>  	*md5 = NULL;
>  #endif
> +	doing_ts = ireq->tstamp_ok;
>  
>  	/* We always send an MSS option. */
>  	opts->mss = mss;
> 
> 

Since you are doing away with flag variable, why not this instead?


--- a/net/ipv4/tcp_output.c	2010-05-17 13:38:32.822025583 -0700
+++ b/net/ipv4/tcp_output.c	2010-05-17 13:41:47.321734775 -0700
@@ -668,7 +668,6 @@ static unsigned tcp_synack_options(struc
 	u8 cookie_plus = (xvp != NULL && !xvp->cookie_out_never) ?
 			 xvp->cookie_plus :
 			 0;
-	bool doing_ts = ireq->tstamp_ok;
 
 #ifdef CONFIG_TCP_MD5SIG
 	*md5 = tcp_rsk(req)->af_specific->md5_lookup(sk, req);
@@ -681,7 +680,7 @@ static unsigned tcp_synack_options(struc
 		 * rather than TS in order to fit in better with old,
 		 * buggy kernels, but that was deemed to be unnecessary.
 		 */
-		doing_ts &= !ireq->sack_ok;
+		ireq->tstamp_ok &= !ireq->sack_ok;
 	}
 #else
 	*md5 = NULL;
@@ -696,7 +695,7 @@ static unsigned tcp_synack_options(struc
 		opts->options |= OPTION_WSCALE;
 		remaining -= TCPOLEN_WSCALE_ALIGNED;
 	}
-	if (likely(doing_ts)) {
+	if (likely(ireq->tstamp_ok)) {
 		opts->options |= OPTION_TS;
 		opts->tsval = TCP_SKB_CB(skb)->when;
 		opts->tsecr = req->ts_recent;
@@ -704,7 +703,7 @@ static unsigned tcp_synack_options(struc
 	}
 	if (likely(ireq->sack_ok)) {
 		opts->options |= OPTION_SACK_ADVERTISE;
-		if (unlikely(!doing_ts))
+		if (unlikely(!ireq->tstamp_ok))
 			remaining -= TCPOLEN_SACKPERM_ALIGNED;
 	}
 
@@ -712,7 +711,7 @@ static unsigned tcp_synack_options(struc
 	 * If the <SYN> options fit, the same options should fit now!
 	 */
 	if (*md5 == NULL &&
-	    doing_ts &&
+	    ireq->tstamp_ok &&
 	    cookie_plus > TCPOLEN_COOKIE_BASE) {
 		int need = cookie_plus; /* has TCPOLEN_COOKIE_BASE */
 


 



-- 

  parent reply	other threads:[~2010-05-17 20:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <i2h571fb4001005031027y4a58c4dtfd28ddcdc08d8401@mail.gmail.com>
2010-05-04  3:30 ` TCP-MD5 checksum failure on x86_64 SMP Bhaskar Dutta
2010-05-04 11:32   ` Ben Hutchings
2010-05-04 14:28     ` Bhaskar Dutta
2010-05-04 16:12       ` Stephen Hemminger
2010-05-04 17:08         ` Bhaskar Dutta
2010-05-04 17:13           ` Stephen Hemminger
2010-05-05 18:03             ` Bhaskar Dutta
2010-05-05 18:53               ` Eric Dumazet
2010-05-06 11:55                 ` Bhaskar Dutta
2010-05-06 12:06                   ` Eric Dumazet
2010-05-07  5:04                     ` David Miller
2010-05-07  5:32                       ` Eric Dumazet
2010-05-07 17:14                         ` Stephen Hemminger
2010-05-07 17:21                           ` Eric Dumazet
2010-05-07 17:36                             ` Stephen Hemminger
2010-05-07 21:40                               ` Eric Dumazet
2010-05-10 14:55                                 ` Bijay Singh
2010-05-10 15:18                                   ` Eric Dumazet
2010-05-10 17:27                                     ` Bijay Singh
2010-05-11  4:08                                     ` Bijay Singh
2010-05-11  6:27                                       ` Eric Dumazet
2010-05-11  8:23                                         ` Bijay Singh
2010-05-11 20:50                                       ` Eric Dumazet
2010-05-12  3:20                                         ` Eric Dumazet
2010-05-12 22:22                                           ` Stephen Hemminger
2010-05-12 22:24                                             ` David Miller
2010-05-16 19:53                                               ` Eric Dumazet
2010-05-16 20:48                                         ` Eric Dumazet
2010-05-17  3:49                                           ` Bijay Singh
2010-05-17  5:03                                             ` Eric Dumazet
2010-05-17 17:22                                               ` Stephen Hemminger
2010-05-17 20:42                                               ` Stephen Hemminger [this message]
2010-05-17 21:04                                                 ` [PATCH] tcp: tcp_synack_options() fix Eric Dumazet
2010-05-18  5:35                                                   ` David Miller
2010-05-16  7:30                               ` TCP-MD5 checksum failure on x86_64 SMP David Miller
2010-05-07  8:46                     ` Lars Eggert
2010-05-07  8:55                       ` Eric Dumazet
2010-05-07  9:12                       ` David Miller
2010-05-07  5:39                   ` Eric Dumazet
2010-05-07  8:00                     ` Eric Dumazet
2010-05-07  8:59                       ` Bhaskar Dutta
2010-05-07  9:37                         ` Eric Dumazet
2010-05-07 10:50                           ` Bhaskar Dutta
2010-05-07 15:18                             ` Eric Dumazet
2010-05-07 15:44                               ` Eric Dumazet
2010-05-07 21:18                                 ` Eric Dumazet
2010-05-16  7:37                                   ` David Miller
2010-05-16  7:35                       ` 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=20100517134240.1949f245@nehalam \
    --to=shemminger@vyatta.com \
    --cc=Bijay.Singh@guavus.com \
    --cc=bhaskie@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=ilpo.jarvinen@helsinki.fi \
    --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).