patch 'ip_frag: randomize hash seed' has been queued to stable release 25.11.3

Kevin Traynor ktraynor at redhat.com
Thu Jul 23 19:15:32 CEST 2026


Hi,

FYI, your patch has been queued to stable release 25.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/27/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/43e9d19004baffde23de4e637273d51525b79c6f

Thanks.

Kevin

---
>From 43e9d19004baffde23de4e637273d51525b79c6f Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Wed, 8 Apr 2026 09:16:17 -0700
Subject: [PATCH] ip_frag: randomize hash seed

[ upstream commit f9c4124c49b6e63e8156a2a89a8fad692cc70413 ]

Both ipv4_frag_hash() and ipv6_frag_hash() use CRC32 (x86/ARM)
or jhash with a fixed, publicly known prime seed (0xeaad8405).
An attacker who can send crafted IP fragments can precompute hash
collisions, causing all fragments to land in the same bucket.
After bucket_entries concurrent flows collide, new flows are  dropped.

Fix by using a random hash seed added at table creation time.

Fixes: 416707812c03 ("ip_frag: refactor reassembly code into a proper library")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
---
 lib/ip_frag/ip_frag_internal.c   | 18 ++++++++----------
 lib/ip_frag/ip_reassembly.h      |  1 +
 lib/ip_frag/rte_ip_frag_common.c |  1 +
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/ip_frag/ip_frag_internal.c b/lib/ip_frag/ip_frag_internal.c
index 7cbef647df..382f42d0e1 100644
--- a/lib/ip_frag/ip_frag_internal.c
+++ b/lib/ip_frag/ip_frag_internal.c
@@ -10,6 +10,4 @@
 #include "ip_frag_common.h"
 
-#define	PRIME_VALUE	0xeaad8405
-
 #define	IP_FRAG_TBL_POS(tbl, sig)	\
 	((tbl)->pkt + ((sig) & (tbl)->entry_mask))
@@ -39,5 +37,5 @@ ip_frag_tbl_reuse(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr,
 
 static inline void
-ipv4_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
+ipv4_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2, uint32_t seed)
 {
 	uint32_t v;
@@ -47,10 +45,10 @@ ipv4_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
 
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
-	v = rte_hash_crc_4byte(p[0], PRIME_VALUE);
+	v = rte_hash_crc_4byte(p[0], seed);
 	v = rte_hash_crc_4byte(p[1], v);
 	v = rte_hash_crc_4byte(key->id, v);
 #else
 
-	v = rte_jhash_3words(p[0], p[1], key->id, PRIME_VALUE);
+	v = rte_jhash_3words(p[0], p[1], key->id, seed);
 #endif /* RTE_ARCH_X86 */
 
@@ -60,5 +58,5 @@ ipv4_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
 
 static inline void
-ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
+ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2, uint32_t seed)
 {
 	uint32_t v;
@@ -68,5 +66,5 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
 
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
-	v = rte_hash_crc_4byte(p[0], PRIME_VALUE);
+	v = rte_hash_crc_4byte(p[0], seed);
 	v = rte_hash_crc_4byte(p[1], v);
 	v = rte_hash_crc_4byte(p[2], v);
@@ -79,5 +77,5 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2)
 #else
 
-	v = rte_jhash_3words(p[0], p[1], p[2], PRIME_VALUE);
+	v = rte_jhash_3words(p[0], p[1], p[2], seed);
 	v = rte_jhash_3words(p[3], p[4], p[5], v);
 	v = rte_jhash_3words(p[6], p[7], key->id, v);
@@ -302,7 +300,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
 	/* different hashing methods for IPv4 and IPv6 */
 	if (key->key_len == IPV4_KEYLEN)
-		ipv4_frag_hash(key, &sig1, &sig2);
+		ipv4_frag_hash(key, &sig1, &sig2, tbl->seed);
 	else
-		ipv6_frag_hash(key, &sig1, &sig2);
+		ipv6_frag_hash(key, &sig1, &sig2, tbl->seed);
 
 	p1 = IP_FRAG_TBL_POS(tbl, sig1);
diff --git a/lib/ip_frag/ip_reassembly.h b/lib/ip_frag/ip_reassembly.h
index 54afed5417..9e1666ef67 100644
--- a/lib/ip_frag/ip_reassembly.h
+++ b/lib/ip_frag/ip_reassembly.h
@@ -80,4 +80,5 @@ struct rte_ip_frag_tbl {
 	uint32_t nb_entries;     /* total size of the table. */
 	uint32_t nb_buckets;     /* num of associativity lines. */
+	uint32_t seed;		 /* hash function init value */
 	struct ip_frag_pkt *last;     /* last used entry. */
 	struct ip_pkt_list lru;       /* LRU list for table entries. */
diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c
index 79ac45289b..00bf9476de 100644
--- a/lib/ip_frag/rte_ip_frag_common.c
+++ b/lib/ip_frag/rte_ip_frag_common.c
@@ -80,4 +80,5 @@ rte_ip_frag_table_create(uint32_t bucket_num, uint32_t bucket_entries,
 	tbl->bucket_entries = bucket_entries;
 	tbl->entry_mask = (tbl->nb_entries - 1) & ~(tbl->bucket_entries  - 1);
+	tbl->seed = rte_rand();
 
 	TAILQ_INIT(&(tbl->lru));
-- 
2.55.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-23 17:58:00.644491778 +0100
+++ 0069-ip_frag-randomize-hash-seed.patch	2026-07-23 17:57:58.686995055 +0100
@@ -1 +1 @@
-From f9c4124c49b6e63e8156a2a89a8fad692cc70413 Mon Sep 17 00:00:00 2001
+From 43e9d19004baffde23de4e637273d51525b79c6f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit f9c4124c49b6e63e8156a2a89a8fad692cc70413 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list