git: 31bc602ff811 - main - Rack and BBR broken with the new timewait state purge.

From: Randall Stewart <rrs_at_FreeBSD.org>
Date: Mon, 24 Oct 2022 19:49:35 UTC
The branch main has been updated by rrs:

URL: https://cgit.FreeBSD.org/src/commit/?id=31bc602ff811a20c8794f48061cccde9277c6a53

commit 31bc602ff811a20c8794f48061cccde9277c6a53
Author:     Randall Stewart <rrs@FreeBSD.org>
AuthorDate: 2022-10-24 19:47:29 +0000
Commit:     Randall Stewart <rrs@FreeBSD.org>
CommitDate: 2022-10-24 19:47:29 +0000

    Rack and BBR broken with the new timewait state purge.
    
    We recently got rid of the explicit INP_TIMEWAIT state, this has caused some
    minor breakage to both rack and bbr. Basically the timewait check that was
    in tcp_lro.c is now gone. This means that compressed_ack and mbuf_queued
    packets will arrive at TCP without going through tcp_input_with_port(). We need
    to expand the check that was stripped to look at the tcp_state (t_state) and
    not "LRO" packets that are in the TCPS_TIMEWAIT state.
    
    Reviewed by: tuexen, gliebus
    Sponsored by: Netflix Inc
    Differential Revision: https://reviews.freebsd.org/D37080
---
 sys/netinet/tcp_lro.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 9ec7736aef2f..4f7457d875e7 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet/tcpip.h>
 #include <netinet/tcp_hpts.h>
 #include <netinet/tcp_log_buf.h>
+#include <netinet/tcp_fsm.h>
 #include <netinet/udp.h>
 #include <netinet6/ip6_var.h>
 
@@ -1359,7 +1360,9 @@ tcp_lro_flush_tcphpts(struct lro_ctrl *lc, struct lro_entry *le)
 	tp = intotcpcb(inp);
 
 	/* Check if the inp is dead, Jim. */
-	if (tp == NULL || (inp->inp_flags & INP_DROPPED)) {
+	if (tp == NULL ||
+	    (inp->inp_flags & INP_DROPPED) ||
+	    (tp->t_state == TCPS_TIME_WAIT)) {
 		INP_WUNLOCK(inp);
 		return (TCP_LRO_CANNOT);
 	}