diff options
author | Eric Dumazet <edumazet@google.com> | 2016-08-22 14:31:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-23 19:55:49 -0400 |
commit | 20a2b49fc538540819a0c552877086548cff8d8d (patch) | |
tree | ee2139e2ca455ec54ba6ba83c3ca134c27bff1b7 /net/ipv6/tcp_ipv6.c | |
parent | 6c389fc931bcda88940c809f752ada6d7799482c (diff) |
tcp: properly scale window in tcp_v[46]_reqsk_send_ack()
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>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 33df8b8575cc..94f4f89d73e7 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -944,9 +944,15 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, | |||
944 | /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV | 944 | /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV |
945 | * sk->sk_state == TCP_SYN_RECV -> for Fast Open. | 945 | * sk->sk_state == TCP_SYN_RECV -> for Fast Open. |
946 | */ | 946 | */ |
947 | /* RFC 7323 2.3 | ||
948 | * The window field (SEG.WND) of every outgoing segment, with the | ||
949 | * exception of <SYN> segments, MUST be right-shifted by | ||
950 | * Rcv.Wind.Shift bits: | ||
951 | */ | ||
947 | tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ? | 952 | tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ? |
948 | tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, | 953 | tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, |
949 | tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, | 954 | tcp_rsk(req)->rcv_nxt, |
955 | req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, | ||
950 | tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if, | 956 | tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if, |
951 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), | 957 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), |
952 | 0, 0); | 958 | 0, 0); |