All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling
@ 2017-02-17 17:04 Cui, Cheng
  2017-02-17 17:44 ` Eric Dumazet
  2017-02-17 20:30 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Cui, Cheng @ 2017-02-17 17:04 UTC (permalink / raw)
  To: netdev
  Cc: David Miller, Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy

Prevent sending out a left-shifted sequence number from a Linux sender in 
response to a peer's shrunk receive-window caused by losing least significant
bits in window-scaling.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Cheng Cui <Cheng.Cui@netapp.com>
---
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1d5331a..634146c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -85,7 +85,8 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb)
 		      tcp_skb_pcount(skb));
 }
 
-/* SND.NXT, if window was not shrunk.
+/* SND.NXT, if window was not shrunk or the amount of shrunk was less than one
+ * window scaling factor due to loss of precision.
  * If window has been shrunk, what should we make? It is not clear at all.
  * Using SND.UNA we will fail to open window, SND.NXT is out of window. :-(
  * Anything in between SND.UNA...SND.UNA+SND.WND also can be already
@@ -95,7 +96,9 @@ static inline __u32 tcp_acceptable_seq(const struct sock *sk)
 {
 	const struct tcp_sock *tp = tcp_sk(sk);
 
-	if (!before(tcp_wnd_end(tp), tp->snd_nxt))
+	if (!before(tcp_wnd_end(tp), tp->snd_nxt) ||
+	    (tp->rx_opt.wscale_ok &&
+	     ((tp->snd_nxt - tcp_wnd_end(tp)) < (1 << tp->rx_opt.rcv_wscale))))
 		return tp->snd_nxt;
 	else
 		return tcp_wnd_end(tp);

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

* Re: [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling
  2017-02-17 17:04 [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling Cui, Cheng
@ 2017-02-17 17:44 ` Eric Dumazet
  2017-02-17 20:30 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-02-17 17:44 UTC (permalink / raw)
  To: Cui, Cheng; +Cc: netdev, David Miller

On Fri, 2017-02-17 at 17:04 +0000, Cui, Cheng wrote:
> Prevent sending out a left-shifted sequence number from a Linux sender in 
> response to a peer's shrunk receive-window caused by losing least significant
> bits in window-scaling.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: James Morris <jmorris@namei.org>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Cc: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Cheng Cui <Cheng.Cui@netapp.com>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling
  2017-02-17 17:04 [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling Cui, Cheng
  2017-02-17 17:44 ` Eric Dumazet
@ 2017-02-17 20:30 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-02-17 20:30 UTC (permalink / raw)
  To: Cheng.Cui; +Cc: netdev, kuznet, jmorris, yoshfuji, kaber

From: "Cui, Cheng" <Cheng.Cui@netapp.com>
Date: Fri, 17 Feb 2017 17:04:55 +0000

> Prevent sending out a left-shifted sequence number from a Linux sender in 
> response to a peer's shrunk receive-window caused by losing least significant
> bits in window-scaling.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: James Morris <jmorris@namei.org>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Cc: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Cheng Cui <Cheng.Cui@netapp.com>

Applied to net-next.

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

end of thread, other threads:[~2017-02-17 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 17:04 [PATCHv2, 1/1] tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling Cui, Cheng
2017-02-17 17:44 ` Eric Dumazet
2017-02-17 20:30 ` David Miller

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.