svn commit: r332178 - stable/11/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sat Apr 7 15:16:58 UTC 2018


Author: tuexen
Date: Sat Apr  7 15:16:57 2018
New Revision: 332178
URL: https://svnweb.freebsd.org/changeset/base/332178

Log:
  MFC r322967:
  
  Fix blackhole detection.
  
  There were two bugs related to the blackhole detection:
  * The smalles size was tried more than two times.
  * The restored MSS was not the original one, but the second
    candidate.
  
  Sponsored by:		Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_timer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_timer.c
==============================================================================
--- stable/11/sys/netinet/tcp_timer.c	Sat Apr  7 15:10:08 2018	(r332177)
+++ stable/11/sys/netinet/tcp_timer.c	Sat Apr  7 15:16:57 2018	(r332178)
@@ -687,19 +687,21 @@ tcp_timer_rexmt(void * xtp)
 		 */
 		if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) ==
 		    (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) &&
-		    (tp->t_rxtshift >= 2 && tp->t_rxtshift % 2 == 0)) {
+		    (tp->t_rxtshift >= 2 && tp->t_rxtshift < 6 &&
+		    tp->t_rxtshift % 2 == 0)) {
 			/*
 			 * Enter Path MTU Black-hole Detection mechanism:
 			 * - Disable Path MTU Discovery (IP "DF" bit).
 			 * - Reduce MTU to lower value than what we
 			 *   negotiated with peer.
 			 */
-			/* Record that we may have found a black hole. */
-			tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE;
+			if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) == 0) {
+				/* Record that we may have found a black hole. */
+				tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE;
+				/* Keep track of previous MSS. */
+				tp->t_pmtud_saved_maxseg = tp->t_maxseg;
+			}
 
-			/* Keep track of previous MSS. */
-			tp->t_pmtud_saved_maxseg = tp->t_maxseg;
-
 			/* 
 			 * Reduce the MSS to blackhole value or to the default
 			 * in an attempt to retransmit.
@@ -757,7 +759,7 @@ tcp_timer_rexmt(void * xtp)
 			 * stage (1448, 1188, 524) 2 chances to recover.
 			 */
 			if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) &&
-			    (tp->t_rxtshift > 6)) {
+			    (tp->t_rxtshift >= 6)) {
 				tp->t_flags2 |= TF2_PLPMTU_PMTUD;
 				tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
 				tp->t_maxseg = tp->t_pmtud_saved_maxseg;


More information about the svn-src-all mailing list