git: f504685a7ade - main - rack/bbr: put back assertion that connection is not in TIME-WAIT

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 31 Oct 2022 15:33:40 UTC
The branch main has been updated by glebius:

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

commit f504685a7adeae2677a5e45faf8674ff08e6ea90
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-10-31 15:30:59 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-10-31 15:30:59 +0000

    rack/bbr: put back assertion that connection is not in TIME-WAIT
    
    The assertion was incorrectly removed in 0d7445193ab.  The leak of
    a TIME-WAIT state into tfb_do_segment_nounlock method was fixed in
    31bc602ff81.  The TIME-WAIT connections are processed by the main
    tcp_input() always.
---
 sys/netinet/tcp_stacks/bbr.c  | 2 ++
 sys/netinet/tcp_stacks/rack.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c
index 4a768487b9f6..a3294118bfc8 100644
--- a/sys/netinet/tcp_stacks/bbr.c
+++ b/sys/netinet/tcp_stacks/bbr.c
@@ -11359,6 +11359,8 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
 	INP_WLOCK_ASSERT(tp->t_inpcb);
 	KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN",
 	    __func__));
+	KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT",
+	    __func__));
 
 	tp->t_rcvtime = ticks;
 	/*
diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index 997e032e4a08..fdac23d0c5cc 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -14154,6 +14154,8 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
 	INP_WLOCK_ASSERT(tp->t_inpcb);
 	KASSERT(tp->t_state > TCPS_LISTEN, ("%s: TCPS_LISTEN",
 	    __func__));
+	KASSERT(tp->t_state != TCPS_TIME_WAIT, ("%s: TCPS_TIME_WAIT",
+	    __func__));
 
 	if ((tp->t_state >= TCPS_FIN_WAIT_1) &&
 	    (tp->t_flags & TF_GPUTINPROG)) {