Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2019 08:14:46 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352284 - in stable/12/sys/netinet: . tcp_stacks
Message-ID:  <201909130814.x8D8EkPe090161@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Fri Sep 13 08:14:46 2019
New Revision: 352284
URL: https://svnweb.freebsd.org/changeset/base/352284

Log:
  MFC r352072:
  
  Only update SACK/DSACK lists when a non-empty segment was received.
  This fixes hitting a KASSERT with a valid packet exchange.
  
  PR:			240471
  Reviewed by:		rrs@, Richard Scheffenegger
  Sponsored by:		Neflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D21567

Modified:
  stable/12/sys/netinet/tcp_input.c
  stable/12/sys/netinet/tcp_stacks/rack.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/tcp_input.c
==============================================================================
--- stable/12/sys/netinet/tcp_input.c	Fri Sep 13 07:24:29 2019	(r352283)
+++ stable/12/sys/netinet/tcp_input.c	Fri Sep 13 08:14:46 2019	(r352284)
@@ -3065,9 +3065,8 @@ dodata:							/* XXX */
 			thflags = tcp_reass(tp, th, &temp, &tlen, m);
 			tp->t_flags |= TF_ACKNOW;
 		}
-		if (tp->t_flags & TF_SACK_PERMIT) {
-			if (((tlen == 0) && (save_tlen > 0) &&
-			    (SEQ_LT(save_start, save_rnxt)))) {
+		if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0)) {
+			if ((tlen == 0) && (SEQ_LT(save_start, save_rnxt))) {
 				/*
 				 * DSACK actually handled in the fastpath
 				 * above.
@@ -3075,20 +3074,20 @@ dodata:							/* XXX */
 				tcp_update_sack_list(tp, save_start,
 				    save_start + save_tlen);
 			} else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) {
-				/*
-				 * Cleaning sackblks by using zero length
-				 * update.
-				 */
 				if ((tp->rcv_numsacks >= 1) &&
 				    (tp->sackblks[0].end == save_start)) {
-					/* partial overlap, recorded at todrop above */
-					tcp_update_sack_list(tp, tp->sackblks[0].start,
+					/*
+					 * Partial overlap, recorded at todrop
+					 * above.
+					 */
+					tcp_update_sack_list(tp,
+					    tp->sackblks[0].start,
 					    tp->sackblks[0].end);
 				} else {
 					tcp_update_dsack_list(tp, save_start,
 					    save_start + save_tlen);
 				}
-			} else if ((tlen > 0) && (tlen >= save_tlen)) {
+			} else if (tlen >= save_tlen) {
 				/* Update of sackblks. */
 				tcp_update_dsack_list(tp, save_start,
 				    save_start + save_tlen);

Modified: stable/12/sys/netinet/tcp_stacks/rack.c
==============================================================================
--- stable/12/sys/netinet/tcp_stacks/rack.c	Fri Sep 13 07:24:29 2019	(r352283)
+++ stable/12/sys/netinet/tcp_stacks/rack.c	Fri Sep 13 08:14:46 2019	(r352284)
@@ -4883,35 +4883,36 @@ dodata:				/* XXX */
 			thflags = tcp_reass(tp, th, &temp, &tlen, m);
 			tp->t_flags |= TF_ACKNOW;
 		}
-		if (((tlen == 0) && (save_tlen > 0) &&
-		    (SEQ_LT(save_start, save_rnxt)))) {
-			/*
-			 * DSACK actually handled in the fastpath
-			 * above.
-			 */
-			tcp_update_sack_list(tp, save_start,
-			    save_start + save_tlen);
-		} else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) {
-			/*
-			 * Cleaning sackblks by using zero length
-			 * update.
-			 */
-			if ((tp->rcv_numsacks >= 1) &&
-			    (tp->sackblks[0].end == save_start)) {
-				/* partial overlap, recorded at todrop above */
-				tcp_update_sack_list(tp, tp->sackblks[0].start,
-				    tp->sackblks[0].end);
-			} else {
+		if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0)) {
+			if ((tlen == 0) && (SEQ_LT(save_start, save_rnxt))) {
+				/*
+				 * DSACK actually handled in the fastpath
+				 * above.
+				 */
+				tcp_update_sack_list(tp, save_start,
+				    save_start + save_tlen);
+			} else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) {
+				if ((tp->rcv_numsacks >= 1) &&
+				    (tp->sackblks[0].end == save_start)) {
+					/*
+					 * Partial overlap, recorded at todrop
+					 * above.
+					 */
+					tcp_update_sack_list(tp,
+					    tp->sackblks[0].start,
+					    tp->sackblks[0].end);
+				} else {
+					tcp_update_dsack_list(tp, save_start,
+					    save_start + save_tlen);
+				}
+			} else if (tlen >= save_tlen) {
+				/* Update of sackblks. */
 				tcp_update_dsack_list(tp, save_start,
 				    save_start + save_tlen);
+			} else if (tlen > 0) {
+				tcp_update_dsack_list(tp, save_start,
+				    save_start + tlen);
 			}
-		} else if ((tlen > 0) && (tlen >= save_tlen)) {
-			/* Update of sackblks. */
-			tcp_update_dsack_list(tp, save_start,
-			    save_start + save_tlen);
-		} else if (tlen > 0) {
-			tcp_update_dsack_list(tp, save_start,
-			    save_start + tlen);
 		}
 	} else {
 		m_freem(m);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909130814.x8D8EkPe090161>