git: 724ad12c947d - stable/15 - tcp: use RFC 6191 for connection recycling in TIME-WAIT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 26 Apr 2026 08:10:42 UTC
The branch stable/15 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=724ad12c947dabaa9f62f81f4342a738e0f42971
commit 724ad12c947dabaa9f62f81f4342a738e0f42971
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-04-17 07:11:41 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-04-26 08:09:03 +0000
tcp: use RFC 6191 for connection recycling in TIME-WAIT
Implement the criteria specified in RFC 6191 for recycling TCP
connections in TIME-WAIT.
Reviewed by: rscheff, Marius Halden
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D56321
Event: Wiesbaden Hackathon 2026
(cherry picked from commit 3a54aa3b0911bef15e014b8a8185e116efb0a918)
---
sys/netinet/tcp_timewait.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 66103f8d0b11..d90178ee03ec 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -261,12 +261,17 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
/*
* If a new connection request is received
* while in TIME_WAIT, drop the old connection
- * and start over if the sequence numbers
- * are above the previous ones.
+ * and start over if allowed by RFC 6191.
* Allow UDP port number changes in this case.
*/
if (((thflags & (TH_SYN | TH_ACK)) == TH_SYN) &&
- SEQ_GT(th->th_seq, tp->rcv_nxt)) {
+ ((((tp->t_flags & TF_RCVD_TSTMP) != 0) &&
+ ((to->to_flags & TOF_TS) != 0) &&
+ TSTMP_LT(tp->ts_recent, to->to_tsval)) ||
+ (((tp->t_flags & TF_RCVD_TSTMP) == 0) &&
+ ((to->to_flags & TOF_TS) != 0) &&
+ (V_tcp_tolerate_missing_ts == 0)) ||
+ SEQ_GT(th->th_seq, tp->rcv_nxt))) {
/*
* In case we can't upgrade our lock just pretend we have
* lost this packet.