]> git.ipfire.org Git - thirdparty/iproute2.git/commit
tc: u32: Fix key folding in sample option
authorPhil Sutter <phil@nwl.cc>
Wed, 4 Aug 2021 09:18:28 +0000 (11:18 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 11 Aug 2021 03:02:43 +0000 (20:02 -0700)
commit9b7ea92b9e3feff2876f772ace01148b7406839c
treedf0e2a95757358fe8b588d56b6c69e52c09f535c
parentd1eacf12b58eb9907dc071f32238388ef3e254c0
tc: u32: Fix key folding in sample option

In between Linux kernel 2.4 and 2.6, key folding for hash tables changed
in kernel space. When iproute2 dropped support for the older algorithm,
the wrong code was removed and kernel 2.4 folding method remained in
place. To get things functional for recent kernels again, restoring the
old code alone was not sufficient - additional byteorder fixes were
needed.

While being at it, make use of ffs() and thereby align the code with how
kernel determines the shift width.

Fixes: 267480f55383c ("Backout the 2.4 utsname hash patch.")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
tc/f_u32.c