diff options
author | Cui, Cheng <Cheng.Cui@netapp.com> | 2017-02-17 12:04:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-17 15:30:33 -0500 |
commit | a4ecb15a2432880353d0de4a35204ab8b65b8751 (patch) | |
tree | db790c28e3b8fc8d2512f8200e98a2e176f234b9 /net/ipv4/tcp_output.c | |
parent | e606519ec3e7ec294b9c15c6248f9ea51e9eb2cb (diff) |
tcp: accommodate sequence number to a peer's shrunk receive window caused by precision loss in window scaling
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 61f272a99a49..22548b5f05cb 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -83,7 +83,8 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb) | |||
83 | tcp_skb_pcount(skb)); | 83 | tcp_skb_pcount(skb)); |
84 | } | 84 | } |
85 | 85 | ||
86 | /* SND.NXT, if window was not shrunk. | 86 | /* SND.NXT, if window was not shrunk or the amount of shrunk was less than one |
87 | * window scaling factor due to loss of precision. | ||
87 | * If window has been shrunk, what should we make? It is not clear at all. | 88 | * If window has been shrunk, what should we make? It is not clear at all. |
88 | * Using SND.UNA we will fail to open window, SND.NXT is out of window. :-( | 89 | * Using SND.UNA we will fail to open window, SND.NXT is out of window. :-( |
89 | * Anything in between SND.UNA...SND.UNA+SND.WND also can be already | 90 | * Anything in between SND.UNA...SND.UNA+SND.WND also can be already |
@@ -93,7 +94,9 @@ static inline __u32 tcp_acceptable_seq(const struct sock *sk) | |||
93 | { | 94 | { |
94 | const struct tcp_sock *tp = tcp_sk(sk); | 95 | const struct tcp_sock *tp = tcp_sk(sk); |
95 | 96 | ||
96 | if (!before(tcp_wnd_end(tp), tp->snd_nxt)) | 97 | if (!before(tcp_wnd_end(tp), tp->snd_nxt) || |
98 | (tp->rx_opt.wscale_ok && | ||
99 | ((tp->snd_nxt - tcp_wnd_end(tp)) < (1 << tp->rx_opt.rcv_wscale)))) | ||
97 | return tp->snd_nxt; | 100 | return tp->snd_nxt; |
98 | else | 101 | else |
99 | return tcp_wnd_end(tp); | 102 | return tcp_wnd_end(tp); |