From ed2685ace7c76d6a29b585dd88266831c38e957b Mon Sep 17 00:00:00 2001 From: Fredi Raspall Date: Fri, 31 Jul 2026 13:23:03 +0200 Subject: [PATCH] feat(net): augment hash_ip() to consider icmp id Augment the hash method for ip packets to consider the ICMP id field (if present). This adds entropy and allows spraying ICMP traffic over ECMP legs. Signed-off-by: Fredi Raspall --- net/src/packet/hash.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/src/packet/hash.rs b/net/src/packet/hash.rs index cbf1aa32cf..b843fe2fdd 100644 --- a/net/src/packet/hash.rs +++ b/net/src/packet/hash.rs @@ -38,7 +38,16 @@ impl Packet { udp.source().hash(state); udp.destination().hash(state); } - &Transport::Icmp4(_) | &Transport::Icmp6(_) => {} + Transport::Icmp4(icmp4) => { + if let Some(id) = icmp4.identifier() { + id.hash(state); + } + } + Transport::Icmp6(icmp6) => { + if let Some(id) = icmp6.identifier() { + id.hash(state); + } + } } } }