git: 57317c8971df - main - tcp: exclude KASSERTS when rescue retransmissions are in play.

From: Richard Scheffenegger <rscheff_at_FreeBSD.org>
Date: Wed, 08 Jun 2022 12:53:32 UTC
The branch main has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=57317c8971df76bd6faeb7dfdc4379097d004caf

commit 57317c8971df76bd6faeb7dfdc4379097d004caf
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2022-06-08 12:21:28 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2022-06-08 12:51:31 +0000

    tcp: exclude KASSERTS when rescue retransmissions are in play.
    
    The KASSERT criteria needs to be checked against the
    sendbuffer so_snd in a subsequent version.
    
    Reviewed By:    tuexen, #transport
    PR:             263445
    MFC after:      1 week
    Sponsored by:   NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D35431
---
 sys/netinet/tcp_sack.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c
index 97f9f6546ca9..9d4333f7f775 100644
--- a/sys/netinet/tcp_sack.c
+++ b/sys/netinet/tcp_sack.c
@@ -970,16 +970,18 @@ tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt)
 		}
 	}
 	KASSERT(SEQ_LT(hole->start, hole->end), ("%s: hole.start >= hole.end", __func__));
-	KASSERT(SEQ_LT(hole->start, tp->snd_fack), ("%s: hole.start >= snd.fack", __func__));
-	KASSERT(SEQ_LT(hole->end, tp->snd_fack), ("%s: hole.end >= snd.fack", __func__));
-	KASSERT(SEQ_LT(hole->rxmit, tp->snd_fack), ("%s: hole.rxmit >= snd.fack", __func__));
-	if (SEQ_GEQ(hole->start, hole->end) ||
-	    SEQ_GEQ(hole->start, tp->snd_fack) ||
-	    SEQ_GEQ(hole->end, tp->snd_fack) ||
-	    SEQ_GEQ(hole->rxmit, tp->snd_fack)) {
-		log(LOG_CRIT,"tcp: invalid SACK hole (%u-%u,%u) vs fwd ack %u, ignoring.\n",
-				hole->start, hole->end, hole->rxmit, tp->snd_fack);
-		return (NULL);
+	if (!(V_tcp_do_newsack)) {
+		KASSERT(SEQ_LT(hole->start, tp->snd_fack), ("%s: hole.start >= snd.fack", __func__));
+		KASSERT(SEQ_LT(hole->end, tp->snd_fack), ("%s: hole.end >= snd.fack", __func__));
+		KASSERT(SEQ_LT(hole->rxmit, tp->snd_fack), ("%s: hole.rxmit >= snd.fack", __func__));
+		if (SEQ_GEQ(hole->start, hole->end) ||
+		    SEQ_GEQ(hole->start, tp->snd_fack) ||
+		    SEQ_GEQ(hole->end, tp->snd_fack) ||
+		    SEQ_GEQ(hole->rxmit, tp->snd_fack)) {
+			log(LOG_CRIT,"tcp: invalid SACK hole (%u-%u,%u) vs fwd ack %u, ignoring.\n",
+					hole->start, hole->end, hole->rxmit, tp->snd_fack);
+			return (NULL);
+		}
 	}
 	return (hole);
 }