aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng Cui <cc@FreeBSD.org>2026-02-09 22:39:50 +0000
committerCheng Cui <cc@FreeBSD.org>2026-02-10 15:08:57 +0000
commita485399f88348efbe52aad2fa9b14af8b9ae55c7 (patch)
tree4fc27b3ed5d4ea1d5acd835f9e7276c9c9dffdad
parent212272a43767c3d7be3ddb87605612f6164774c1 (diff)
tcp: restrict flowtype copying to specific RSS TCP types
Reviewed by: gallatin, tuexen Differential Revision: https://reviews.freebsd.org/D55196
-rw-r--r--sys/netinet/tcp_syncache.c4
-rw-r--r--sys/sys/mbuf.h4
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)