Patch "tcp: properly scale window in tcp_v[46]_reqsk_send_ack()" has been added to the 4.7-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
tcp: properly scale window in tcp_v[46]_reqsk_send_ack()
to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tcp-properly-scale-window-in-tcp_v_reqsk_send_ack.patch
and it can be found in the queue-4.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Wed Sep 21 10:05:18 CEST 2016
From: Eric Dumazet <[email protected]>
Date: Mon, 22 Aug 2016 11:31:10 -0700
Subject: tcp: properly scale window in tcp_v[46]_reqsk_send_ack()
From: Eric Dumazet <[email protected]>
[ Upstream commit 20a2b49fc538540819a0c552877086548cff8d8d ]
When sending an ack in SYN_RECV state, we must scale the offered window if wscale option was negotiated and accepted.
Tested:
Following packetdrill test demonstrates the issue :
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
// Establish a connection.
+0 < S 0:0(0) win 20000 <mss 1000,sackOK,wscale 7, nop, TS val 100 ecr 0> +0 > S. 0:0(0) ack 1 win 28960 <mss 1460,sackOK, TS val 100 ecr 100, nop, wscale 7>
+0 < . 1:11(10) ack 1 win 156 <nop,nop,TS val 99 ecr 100> // check that window is properly scaled !
+0 > . 1:1(0) ack 1 win 226 <nop,nop,TS val 200 ecr 100>
--- net/ipv4/tcp_ipv4.c | 8 +++++++- net/ipv6/tcp_ipv6.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +7 -1
@@ -814,8 +814,14 @@ static void tcp_v4_reqsk_send_ack(constu32 seq = (sk->sk_state ==TCP_LISTEN ) ?tcp_rsk (req)->snt_isn +1 :tcp_sk (sk)->snd_nxt; +/* RFC 7323 2.3 +* The window field (SEG.WND) of every outgoing segment, with the +* exception of <SYN> segments, MUST be right-shifted by +* Rcv.Wind.Shift bits: +*/ tcp_v4_send_ack(sock_net(sk), skb, seq, - tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, + tcp_rsk(req)->rcv_nxt, + req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, tcp_time_stamp, req->ts_recent, 0,
net/ipv6/tcp_ipv6.c +7 -1
@@ -937,9 +937,15 @@ static void tcp_v6_reqsk_send_ack(const/* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV * sk->sk_state == TCP_SYN_RECV -> for Fast Open. */ +/* RFC 7323 2.3 +* The window field (SEG.WND) of every outgoing segment, with the +* exception of <SYN> segments, MUST be right-shifted by +* Rcv.Wind.Shift bits: +*/ tcp_v6_send_ack (sk, skb, (sk->sk_state ==TCP_LISTEN ) ?tcp_rsk (req)->snt_isn +1 :tcp_sk (sk)->snd_nxt, -tcp_rsk (req)->rcv_nxt, req->rsk_rcv_wnd, +tcp_rsk (req)->rcv_nxt, + req->rsk_rcv_wnd >>inet_rsk (req)->rcv_wscale, tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if,tcp_v6_md5_do_lookup (sk, &ipv6_hdr (skb)->daddr),0 ,0 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.7/bonding-fix-bonding-crash.patch queue-4.7/tcp-properly-scale-window-in-tcp_v_reqsk_send_ack.patch queue-4.7/tcp-fastopen-avoid-negative-sk_forward_alloc.patch queue-4.7/udp-fix-poll-issue-with-zero-sized-packets.patch queue-4.7/tcp-fix-use-after-free-in-tcp_xmit_retransmit_queue.patch queue-4.7/tun-fix-transmit-timestamp-support.patch