tcp: disable Fast Open on timeouts after handshake
Subsystems (3)
PATCH 1/2 tcp: disable Fast Open on timeouts after handshake
Some middle-boxes black-hole the data after the Fast Open handshake
(https://www.ietf.org/proceedings/94/slides/slides-94-tcpm-13.pdf).
The exact reason is unknown. The work-around is to disable Fast Open temporarily after multiple recurring timeouts with few or no data delivered in the established state.
--- net/ipv4/tcp_timer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/ipv4/tcp_timer.c +12 -0
@@ -176,6 +176,18 @@ static int tcp_write_timeout(struct sock *sk) syn_set = true; }else {if (retransmits_timed_out (sk, sysctl_tcp_retries1,0 ,0 )) { +/* Some middle-boxes may black-hole Fast Open _after_ +* the handshake. Therefore we conservatively disable +* Fast Open on this path on recurring timeouts with +* few or zero bytes acked after Fast Open. +*/ +if (tp->syn_data_acked && + tp->bytes_acked <= tp->rx_opt.mss_clamp) { +tcp_fastopen_cache_set (sk,0 ,NULL , true,0 ); +if (icsk->icsk_retransmits == sysctl_tcp_retries1) +NET_INC_STATS_BH (sock_net (sk), +LINUX_MIB_TCPFASTOPENACTIVEFAIL ); + }/* Black hole detection */ tcp_mtu_probing (icsk, sk);
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 2/2 tcp: fix Fast Open snmp over-counting bug
Fix incrementing TCPFastOpenActiveFailed snmp stats multiple times when the handshake experiences multiple SYN timeouts.
--- net/ipv4/tcp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -1
@@ -168,7 +168,7 @@ static int tcp_write_timeout(struct sock *sk)dst_negative_advice (sk);if (tp->syn_fastopen || tp->syn_data)tcp_fastopen_cache_set (sk,0 ,NULL , true,0 ); -if (tp->syn_data) +if (tp->syn_data && icsk->icsk_retransmits ==1 )NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPFASTOPENACTIVEFAIL ); }
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
Re: [PATCH net 2/2] tcp: fix Fast Open snmp over-counting bug
From: Yuchung Cheng <[email protected]>
Date: Wed, 18 Nov 2015 18:17:31 -0800
Quoted 5 lines
Fix incrementing TCPFastOpenActiveFailed snmp stats multiple times when the handshake experiences multiple SYN timeouts.
Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>
Applied.
David Miller
maintainerFrom: Yuchung Cheng <[email protected]>
Date: Wed, 18 Nov 2015 18:17:30 -0800
Quoted 9 lines
Some middle-boxes black-hole the data after the Fast Open handshake
(https://www.ietf.org/proceedings/94/slides/slides-94-tcpm-13.pdf).
The exact reason is unknown. The work-around is to disable Fast Open temporarily after multiple recurring timeouts with few or no data delivered in the established state.Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Reported-by Christoph Paasch <[email protected]>
Applied and queued up for -stable.
Just out of curiosity, why isn't a test for zero data sufficient?
Do these middle-boxes sometimes not black-hole all of the data?
Quoted 13 lines · David Miller
From: Yuchung Cheng <[email protected]>
Date: Wed, 18 Nov 2015 18:17:30 -0800Quoted 9 lines
Some middle-boxes black-hole the data after the Fast Open handshake
(https://www.ietf.org/proceedings/94/slides/slides-94-tcpm-13.pdf).
The exact reason is unknown. The work-around is to disable Fast Open temporarily after multiple recurring timeouts with few or no data delivered in the established state.Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Reported-by Christoph Paasch <[email protected]>
Quoted 5 lines
Applied and queued up for -stable.
Just out of curiosity, why isn't a test for zero data sufficient?
Do these middle-boxes sometimes not black-hole all of the data?
Great question. I should be more clear in the commit message. The answer is yes it should be sufficient. The tricky part is tp->bytes_acked includes data acked in the SYN. Since we don't remember data size sent in SYN, hence the heuristic.