aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_timer.c
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2019-01-16 18:05:31 -0500
committerDavid S. Miller <davem@davemloft.net>2019-01-17 18:12:26 -0500
commitc7d13c8faa74f4e8ef191f88a252cefab6805b38 (patch)
tree7735bcd0953efa72c57f5c53ee53d86986de0f0c /net/ipv4/tcp_timer.c
parent7ae189759cc48cf8b54beebff566e9fd2d4e7d7c (diff)
tcp: properly track retry time on passive Fast Open
This patch addresses a corner issue on timeout behavior of a passive Fast Open socket. A passive Fast Open server may write and close the socket when it is re-trying SYN-ACK to complete the handshake. After the handshake is completely, the server does not properly stamp the recovery start time (tp->retrans_stamp is 0), and the socket may abort immediately on the very first FIN timeout, instead of retying until it passes the system or user specified limit. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r--net/ipv4/tcp_timer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 1e61f0bd6e24..074de38bafbd 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -378,6 +378,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
378 struct inet_connection_sock *icsk = inet_csk(sk); 378 struct inet_connection_sock *icsk = inet_csk(sk);
379 int max_retries = icsk->icsk_syn_retries ? : 379 int max_retries = icsk->icsk_syn_retries ? :
380 sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */ 380 sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
381 struct tcp_sock *tp = tcp_sk(sk);
381 struct request_sock *req; 382 struct request_sock *req;
382 383
383 req = tcp_sk(sk)->fastopen_rsk; 384 req = tcp_sk(sk)->fastopen_rsk;
@@ -395,6 +396,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
395 inet_rtx_syn_ack(sk, req); 396 inet_rtx_syn_ack(sk, req);
396 req->num_timeout++; 397 req->num_timeout++;
397 icsk->icsk_retransmits++; 398 icsk->icsk_retransmits++;
399 if (!tp->retrans_stamp)
400 tp->retrans_stamp = tcp_time_stamp(tp);
398 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, 401 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
399 TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); 402 TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
400} 403}