Skip to content

Commit

Permalink
lb/pkt_hash: Fix ip_hl check.
Browse files Browse the repository at this point in the history
Due to the missing ntohs, the hash can be erroneously set to zero, which
breaks load balancing.
  • Loading branch information
J-Gras committed Aug 19, 2022
1 parent af75adb commit 75294f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/lb/pkt_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 75294f3

Please sign in to comment.