netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
@ 2008-08-23 17:18 Philip Love
  2008-08-23 17:20 ` Adam Langley
  2008-08-24  4:40 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Philip Love @ 2008-08-23 17:18 UTC (permalink / raw)
  To: netdev

tcp: fix tcp header size miscalculation when window scale is unused

The size of the TCP header is miscalculated when the window scale ends  
up being
0. Additionally, this can be induced by sending a SYN to a passive  
open port
with a window scale option with value 0.

Signed-off-by: Philip Love <love_phil@emc.com>

---

net/ipv4/tcp_output.c |    6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a00532d..71eea00 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct sock *sk,  
struct sk_buff *skb,
	}
	if (likely(sysctl_tcp_window_scaling)) {
		opts->ws = tp->rx_opt.rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if (likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
	}
	if (likely(sysctl_tcp_sack)) {
		opts->options |= OPTION_SACK_ADVERTISE;
@@ -509,7 +510,8 @@ static unsigned tcp_synack_options(struct sock *sk,

	if (likely(ireq->wscale_ok)) {
		opts->ws = ireq->rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if (likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
	}
	if (likely(doing_ts)) {
		opts->options |= OPTION_TS;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-23 17:18 [PATCH] tcp: fix tcp header size miscalculation when window scale is unused Philip Love
@ 2008-08-23 17:20 ` Adam Langley
  2008-08-24  4:40 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: Adam Langley @ 2008-08-23 17:20 UTC (permalink / raw)
  To: Philip Love; +Cc: netdev

On Sat, Aug 23, 2008 at 10:18 AM, Philip Love <love_phil@emc.com> wrote:
> tcp: fix tcp header size miscalculation when window scale is unused

Reviewed-by: Adam Langley <agl@imperialviolet.org>



AGL

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-23 17:18 [PATCH] tcp: fix tcp header size miscalculation when window scale is unused Philip Love
  2008-08-23 17:20 ` Adam Langley
@ 2008-08-24  4:40 ` David Miller
  2008-08-24 17:40   ` Adam Langley
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2008-08-24  4:40 UTC (permalink / raw)
  To: love_phil; +Cc: netdev

From: Philip Love <love_phil@emc.com>
Date: Sat, 23 Aug 2008 10:18:27 -0700

> tcp: fix tcp header size miscalculation when window scale is unused
> 
> The size of the TCP header is miscalculated when the window scale ends  
> up being
> 0. Additionally, this can be induced by sending a SYN to a passive  
> open port
> with a window scale option with value 0.
> 
> Signed-off-by: Philip Love <love_phil@emc.com>

This patch has been mangled by your email client, long lines have been
broken up, leading spaces and tabs have been converted to pure tab
characters, etc.

There I cannot apply the patch.

Please turn off all content modifications in your email client and
resubmit this, thank you.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-24  4:40 ` David Miller
@ 2008-08-24 17:40   ` Adam Langley
  2008-08-25  0:45     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Langley @ 2008-08-24 17:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, love_phil

From: Philip Love <love_phil@emc.com>

tcp: fix tcp header size miscalculation when window scale is unused

The size of the TCP header is miscalculated when the window scale ends up being
0. Additionally, this can be induced by sending a SYN to a passive open port
with a window scale option with value 0.

Signed-off-by: Philip Love <love_phil@emc.com>
Signed-off-by: Adam Langley <agl@imperialviolet.org>

---

 net/ipv4/tcp_output.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a00532d..71eea00 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb,
 	}
 	if (likely(sysctl_tcp_window_scaling)) {
 		opts->ws = tp->rx_opt.rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if (likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
 	}
 	if (likely(sysctl_tcp_sack)) {
 		opts->options |= OPTION_SACK_ADVERTISE;
@@ -509,7 +510,8 @@ static unsigned tcp_synack_options(struct sock *sk,
 
 	if (likely(ireq->wscale_ok)) {
 		opts->ws = ireq->rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if (likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
 	}
 	if (likely(doing_ts)) {
 		opts->options |= OPTION_TS;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-24 17:40   ` Adam Langley
@ 2008-08-25  0:45     ` David Miller
  2008-08-25 16:30       ` Phil Love
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2008-08-25  0:45 UTC (permalink / raw)
  To: agl; +Cc: netdev, love_phil

From: "Adam Langley" <agl@imperialviolet.org>
Date: Sun, 24 Aug 2008 10:40:23 -0700

> From: Philip Love <love_phil@emc.com>
> 
> tcp: fix tcp header size miscalculation when window scale is unused
> 
> The size of the TCP header is miscalculated when the window scale ends up being
> 0. Additionally, this can be induced by sending a SYN to a passive open port
> with a window scale option with value 0.
> 
> Signed-off-by: Philip Love <love_phil@emc.com>
> Signed-off-by: Adam Langley <agl@imperialviolet.org>

Adam I really appreciate you're fixing up the patch for Philip, but
how in the world is he ever going to learn how to submit a patch
properly if you just do it for him?

I could have fixed it up too, but I pushed it back so that he learns
how to submit a patch correctly, and this will help him and the rest
of us in the future when he wants to submit other patches.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-25  0:45     ` David Miller
@ 2008-08-25 16:30       ` Phil Love
  2008-08-25 21:07         ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Phil Love @ 2008-08-25 16:30 UTC (permalink / raw)
  To: netdev

Here is the patch using Thunderbird, rather than Apple Mail. Hopefully 
it is not mangled this time.

Signed-off-by: Philip Love <love_phil@emc.com>

--- a/net/ipv4/tcp_output.c	2008-08-24 07:44:18.000000000 -0700
+++ b/net/ipv4/tcp_output.c	2008-08-24 07:43:05.000000000 -0700
@@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct s
  	}
  	if (likely(sysctl_tcp_window_scaling)) {
  		opts->ws = tp->rx_opt.rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if(likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
  	}
  	if (likely(sysctl_tcp_sack)) {
  		opts->options |= OPTION_SACK_ADVERTISE;
@@ -509,7 +510,8 @@ static unsigned tcp_synack_options(struc

  	if (likely(ireq->wscale_ok)) {
  		opts->ws = ireq->rcv_wscale;
-		size += TCPOLEN_WSCALE_ALIGNED;
+		if(likely(opts->ws))
+			size += TCPOLEN_WSCALE_ALIGNED;
  	}
  	if (likely(doing_ts)) {
  		opts->options |= OPTION_TS;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] tcp: fix tcp header size miscalculation when window scale is unused
  2008-08-25 16:30       ` Phil Love
@ 2008-08-25 21:07         ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2008-08-25 21:07 UTC (permalink / raw)
  To: love_phil; +Cc: netdev

From: Phil Love <love_phil@emc.com>
Date: Mon, 25 Aug 2008 09:30:13 -0700

> Here is the patch using Thunderbird, rather than Apple Mail. Hopefully 
> it is not mangled this time.
> 
> Signed-off-by: Philip Love <love_phil@emc.com>

Unfortunately it is still mangled.

> --- a/net/ipv4/tcp_output.c	2008-08-24 07:44:18.000000000 -0700
> +++ b/net/ipv4/tcp_output.c	2008-08-24 07:43:05.000000000 -0700
> @@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct s
>   	}
>   	if (likely(sysctl_tcp_window_scaling)) {
>   		opts->ws = tp->rx_opt.rcv_wscale;
> -		size += TCPOLEN_WSCALE_ALIGNED;
> +		if(likely(opts->ws))
> +			size += TCPOLEN_WSCALE_ALIGNED;
>   	}
>   	if (likely(sysctl_tcp_sack)) {
>   		opts->options |= OPTION_SACK_ADVERTISE;

On those lines of the patch where no changes are occuring there
should be a single space then one or more tab characters.

There are instead two spaces then the tab characters.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-08-25 21:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-23 17:18 [PATCH] tcp: fix tcp header size miscalculation when window scale is unused Philip Love
2008-08-23 17:20 ` Adam Langley
2008-08-24  4:40 ` David Miller
2008-08-24 17:40   ` Adam Langley
2008-08-25  0:45     ` David Miller
2008-08-25 16:30       ` Phil Love
2008-08-25 21:07         ` David Miller

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).