git: a485399f8834 - main - tcp: restrict flowtype copying to specific RSS TCP types

From: Cheng Cui <cc_at_FreeBSD.org>
Date: Tue, 10 Feb 2026 15:09:27 UTC
The branch main has been updated by cc:

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

commit a485399f88348efbe52aad2fa9b14af8b9ae55c7
Author:     Cheng Cui <cc@FreeBSD.org>
AuthorDate: 2026-02-09 22:39:50 +0000
Commit:     Cheng Cui <cc@FreeBSD.org>
CommitDate: 2026-02-10 15:08:57 +0000

    tcp: restrict flowtype copying to specific RSS TCP types
    
    Reviewed by:    gallatin, tuexen
    Differential Revision:  https://reviews.freebsd.org/D55196
---
 sys/netinet/tcp_syncache.c | 4 ++--
 sys/sys/mbuf.h             | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 4b501b221bcb..1d628bce0d80 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1173,7 +1173,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
 			return (-1); /* Do not send RST */
 		}
 #endif /* TCP_SIGNATURE */
-		if (m != NULL && M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
+		if (m != NULL && M_HASHTYPE_ISHASH_TCP(m)) {
 			sc->sc_flowid = m->m_pkthdr.flowid;
 			sc->sc_flowtype = M_HASHTYPE_GET(m);
 		}
@@ -1771,7 +1771,7 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
 		sc->sc_flowlabel = htonl(sc->sc_flowlabel) & IPV6_FLOWLABEL_MASK;
 	}
 #endif
-	if (m != NULL && M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
+	if (m != NULL && M_HASHTYPE_ISHASH_TCP(m)) {
 		sc->sc_flowid = m->m_pkthdr.flowid;
 		sc->sc_flowtype = M_HASHTYPE_GET(m);
 	}
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 1f1b05857ebf..1e09891d259f 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -579,6 +579,10 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff)
 #define	M_HASHTYPE_TEST(m, v)	(M_HASHTYPE_GET(m) == (v))
 #define	M_HASHTYPE_ISHASH(m)	\
     (((m)->m_pkthdr.rsstype & M_HASHTYPE_HASHPROP) != 0)
+#define	M_HASHTYPE_ISHASH_TCP(m)				\
+    (((m)->m_pkthdr.rsstype & (M_HASHTYPE_RSS_TCP_IPV4 |		\
+				M_HASHTYPE_RSS_TCP_IPV6 |		\
+				M_HASHTYPE_RSS_TCP_IPV6_EX)) != 0)
 #define	M_HASHTYPE_SETINNER(m)	do {			\
 	(m)->m_pkthdr.rsstype |= M_HASHTYPE_INNER;	\
     } while (0)