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>
This commit is contained in:
Родитель
7ae189759c
Коммит
c7d13c8faa
|
@ -378,6 +378,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
|
||||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
||||||
int max_retries = icsk->icsk_syn_retries ? :
|
int max_retries = icsk->icsk_syn_retries ? :
|
||||||
sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
|
sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
|
||||||
|
struct tcp_sock *tp = tcp_sk(sk);
|
||||||
struct request_sock *req;
|
struct request_sock *req;
|
||||||
|
|
||||||
req = tcp_sk(sk)->fastopen_rsk;
|
req = tcp_sk(sk)->fastopen_rsk;
|
||||||
|
@ -395,6 +396,8 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
|
||||||
inet_rtx_syn_ack(sk, req);
|
inet_rtx_syn_ack(sk, req);
|
||||||
req->num_timeout++;
|
req->num_timeout++;
|
||||||
icsk->icsk_retransmits++;
|
icsk->icsk_retransmits++;
|
||||||
|
if (!tp->retrans_stamp)
|
||||||
|
tp->retrans_stamp = tcp_time_stamp(tp);
|
||||||
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
|
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
|
||||||
TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
|
TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче