From 75294f31aeab8733ed1cf49450985896c1a94787 Mon Sep 17 00:00:00 2001 From: Jan Grashoefer Date: Fri, 19 Aug 2022 23:00:16 +0200 Subject: [PATCH] lb/pkt_hash: Fix ip_hl check. Due to the missing ntohs, the hash can be erroneously set to zero, which breaks load balancing. --- apps/lb/pkt_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/lb/pkt_hash.c b/apps/lb/pkt_hash.c index eb9704fd2..b8467be6a 100644 --- a/apps/lb/pkt_hash.c +++ b/apps/lb/pkt_hash.c @@ -150,7 +150,7 @@ decode_ip_n_hash(const struct ip *iph, uint8_t hash_split, uint8_t seed) { uint32_t rc = 0; - if (iph->ip_hl < 5 || iph->ip_hl * 4 > iph->ip_len) { + if (iph->ip_hl < 5 || (iph->ip_hl<<2) > ntohs(iph->ip_len)) { rc = 0; } else if (hash_split == 2) { rc = sym_hash_fn(ntohl(iph->ip_src.s_addr),