diff options
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r-- | net/ipv4/tcp_timer.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index c9c716a483e4..a4730a28b220 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -24,9 +24,6 @@ | |||
24 | 24 | ||
25 | int sysctl_tcp_syn_retries __read_mostly = TCP_SYN_RETRIES; | 25 | int sysctl_tcp_syn_retries __read_mostly = TCP_SYN_RETRIES; |
26 | int sysctl_tcp_synack_retries __read_mostly = TCP_SYNACK_RETRIES; | 26 | int sysctl_tcp_synack_retries __read_mostly = TCP_SYNACK_RETRIES; |
27 | int sysctl_tcp_keepalive_time __read_mostly = TCP_KEEPALIVE_TIME; | ||
28 | int sysctl_tcp_keepalive_probes __read_mostly = TCP_KEEPALIVE_PROBES; | ||
29 | int sysctl_tcp_keepalive_intvl __read_mostly = TCP_KEEPALIVE_INTVL; | ||
30 | int sysctl_tcp_retries1 __read_mostly = TCP_RETR1; | 27 | int sysctl_tcp_retries1 __read_mostly = TCP_RETR1; |
31 | int sysctl_tcp_retries2 __read_mostly = TCP_RETR2; | 28 | int sysctl_tcp_retries2 __read_mostly = TCP_RETR2; |
32 | int sysctl_tcp_orphan_retries __read_mostly; | 29 | int sysctl_tcp_orphan_retries __read_mostly; |
@@ -168,7 +165,7 @@ static int tcp_write_timeout(struct sock *sk) | |||
168 | dst_negative_advice(sk); | 165 | dst_negative_advice(sk); |
169 | if (tp->syn_fastopen || tp->syn_data) | 166 | if (tp->syn_fastopen || tp->syn_data) |
170 | tcp_fastopen_cache_set(sk, 0, NULL, true, 0); | 167 | tcp_fastopen_cache_set(sk, 0, NULL, true, 0); |
171 | if (tp->syn_data) | 168 | if (tp->syn_data && icsk->icsk_retransmits == 1) |
172 | NET_INC_STATS_BH(sock_net(sk), | 169 | NET_INC_STATS_BH(sock_net(sk), |
173 | LINUX_MIB_TCPFASTOPENACTIVEFAIL); | 170 | LINUX_MIB_TCPFASTOPENACTIVEFAIL); |
174 | } | 171 | } |
@@ -176,6 +173,18 @@ static int tcp_write_timeout(struct sock *sk) | |||
176 | syn_set = true; | 173 | syn_set = true; |
177 | } else { | 174 | } else { |
178 | if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0, 0)) { | 175 | if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0, 0)) { |
176 | /* Some middle-boxes may black-hole Fast Open _after_ | ||
177 | * the handshake. Therefore we conservatively disable | ||
178 | * Fast Open on this path on recurring timeouts with | ||
179 | * few or zero bytes acked after Fast Open. | ||
180 | */ | ||
181 | if (tp->syn_data_acked && | ||
182 | tp->bytes_acked <= tp->rx_opt.mss_clamp) { | ||
183 | tcp_fastopen_cache_set(sk, 0, NULL, true, 0); | ||
184 | if (icsk->icsk_retransmits == sysctl_tcp_retries1) | ||
185 | NET_INC_STATS_BH(sock_net(sk), | ||
186 | LINUX_MIB_TCPFASTOPENACTIVEFAIL); | ||
187 | } | ||
179 | /* Black hole detection */ | 188 | /* Black hole detection */ |
180 | tcp_mtu_probing(icsk, sk); | 189 | tcp_mtu_probing(icsk, sk); |
181 | 190 | ||