Improve the TCP blackhole detection. The principle is to reduce the
MSS in two steps and try each candidate two times. However, if two candidates are the same (which is the case in TCP/IPv6), this candidate was tested four times. This patch ensures that each candidate actually reduced the MSS and is only tested 2 times. This reduces the time window of missclassifying a temporary outage as an MTU issue. Reviewed by: jtl MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D24308
This commit is contained in:
parent
9ed8321078
commit
b89af8e16d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359926
@ -723,16 +723,40 @@ tcp_timer_rexmt(void * xtp)
|
|||||||
(V_tcp_pmtud_blackhole_detect == 3 && isipv6)) &&
|
(V_tcp_pmtud_blackhole_detect == 3 && isipv6)) &&
|
||||||
((tp->t_state == TCPS_ESTABLISHED) ||
|
((tp->t_state == TCPS_ESTABLISHED) ||
|
||||||
(tp->t_state == TCPS_FIN_WAIT_1))) {
|
(tp->t_state == TCPS_FIN_WAIT_1))) {
|
||||||
|
if (tp->t_rxtshift == 1) {
|
||||||
/*
|
/*
|
||||||
* Idea here is that at each stage of mtu probe (usually, 1448
|
* We enter blackhole detection after the first
|
||||||
* -> 1188 -> 524) should be given 2 chances to recover before
|
* unsuccessful timer based retransmission.
|
||||||
* further clamping down. 'tp->t_rxtshift % 2 == 0' should
|
* Then we reduce up to two times the MSS, each
|
||||||
* take care of that.
|
* candidate giving two tries of retransmissions.
|
||||||
|
* But we give a candidate only two tries, if it
|
||||||
|
* actually reduces the MSS.
|
||||||
*/
|
*/
|
||||||
|
tp->t_blackhole_enter = 2;
|
||||||
|
tp->t_blackhole_exit = tp->t_blackhole_enter;
|
||||||
|
if (isipv6) {
|
||||||
|
#ifdef INET6
|
||||||
|
if (tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss)
|
||||||
|
tp->t_blackhole_exit += 2;
|
||||||
|
if (tp->t_maxseg > V_tcp_v6mssdflt &&
|
||||||
|
V_tcp_v6pmtud_blackhole_mss > V_tcp_v6mssdflt)
|
||||||
|
tp->t_blackhole_exit += 2;
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#ifdef INET
|
||||||
|
if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss)
|
||||||
|
tp->t_blackhole_exit += 2;
|
||||||
|
if (tp->t_maxseg > V_tcp_mssdflt &&
|
||||||
|
V_tcp_pmtud_blackhole_mss > V_tcp_mssdflt)
|
||||||
|
tp->t_blackhole_exit += 2;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
|
if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
|
||||||
(TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) &&
|
(TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) &&
|
||||||
(tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 &&
|
(tp->t_rxtshift >= tp->t_blackhole_enter &&
|
||||||
tp->t_rxtshift % 2 == 0)) {
|
tp->t_rxtshift < tp->t_blackhole_exit &&
|
||||||
|
(tp->t_rxtshift - tp->t_blackhole_enter) % 2 == 0)) {
|
||||||
/*
|
/*
|
||||||
* Enter Path MTU Black-hole Detection mechanism:
|
* Enter Path MTU Black-hole Detection mechanism:
|
||||||
* - Disable Path MTU Discovery (IP "DF" bit).
|
* - Disable Path MTU Discovery (IP "DF" bit).
|
||||||
@ -752,7 +776,8 @@ tcp_timer_rexmt(void * xtp)
|
|||||||
*/
|
*/
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
if (isipv6 &&
|
if (isipv6 &&
|
||||||
tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) {
|
tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss &&
|
||||||
|
V_tcp_v6pmtud_blackhole_mss > V_tcp_v6mssdflt) {
|
||||||
/* Use the sysctl tuneable blackhole MSS. */
|
/* Use the sysctl tuneable blackhole MSS. */
|
||||||
tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss;
|
tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss;
|
||||||
TCPSTAT_INC(tcps_pmtud_blackhole_activated);
|
TCPSTAT_INC(tcps_pmtud_blackhole_activated);
|
||||||
@ -771,7 +796,8 @@ tcp_timer_rexmt(void * xtp)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) {
|
if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss &&
|
||||||
|
V_tcp_pmtud_blackhole_mss > V_tcp_mssdflt) {
|
||||||
/* Use the sysctl tuneable blackhole MSS. */
|
/* Use the sysctl tuneable blackhole MSS. */
|
||||||
tp->t_maxseg = V_tcp_pmtud_blackhole_mss;
|
tp->t_maxseg = V_tcp_pmtud_blackhole_mss;
|
||||||
TCPSTAT_INC(tcps_pmtud_blackhole_activated);
|
TCPSTAT_INC(tcps_pmtud_blackhole_activated);
|
||||||
@ -798,11 +824,9 @@ tcp_timer_rexmt(void * xtp)
|
|||||||
* with a lowered MTU, maybe this isn't a blackhole and
|
* with a lowered MTU, maybe this isn't a blackhole and
|
||||||
* we restore the previous MSS and blackhole detection
|
* we restore the previous MSS and blackhole detection
|
||||||
* flags.
|
* flags.
|
||||||
* The limit '6' is determined by giving each probe
|
|
||||||
* stage (1448, 1188, 524) 2 chances to recover.
|
|
||||||
*/
|
*/
|
||||||
if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
|
if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
|
||||||
(tp->t_rxtshift >= 6)) {
|
(tp->t_rxtshift >= tp->t_blackhole_exit)) {
|
||||||
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
|
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
|
||||||
tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
|
tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
|
||||||
tp->t_maxseg = tp->t_pmtud_saved_maxseg;
|
tp->t_maxseg = tp->t_pmtud_saved_maxseg;
|
||||||
|
@ -169,6 +169,8 @@ struct tcpcb {
|
|||||||
u_int t_starttime; /* time connection was established */
|
u_int t_starttime; /* time connection was established */
|
||||||
|
|
||||||
u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */
|
u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */
|
||||||
|
int t_blackhole_enter; /* when to enter blackhole detection */
|
||||||
|
int t_blackhole_exit; /* when to exit blackhole detection */
|
||||||
u_int t_rttmin; /* minimum rtt allowed */
|
u_int t_rttmin; /* minimum rtt allowed */
|
||||||
|
|
||||||
u_int t_rttbest; /* best rtt we've seen */
|
u_int t_rttbest; /* best rtt we've seen */
|
||||||
|
Loading…
Reference in New Issue
Block a user