sch_cake: fix srchost/dsthost hashing mode
authorToke Høiland-Jørgensen <toke@redhat.com>
Mon, 16 Aug 2021 11:59:17 +0000 (13:59 +0200)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:49 +0000 (08:35 -0400)
commitdf61235881c8d331fa6ac0b91d4591f7030d6adf
treea1003e37626c97465cf6ea0390e1d30a7714dcbd
parente1ec5858bae13e5529626566c1b0ff742b97ebbe
sch_cake: fix srchost/dsthost hashing mode

[ Upstream commit 86b9bbd332d0510679c7fedcee3e3bd278be5756 ]

When adding support for using the skb->hash value as the flow hash in CAKE,
I accidentally introduced a logic error that broke the host-only isolation
modes of CAKE (srchost and dsthost keywords). Specifically, the flow_hash
variable should stay initialised to 0 in cake_hash() in pure host-based
hashing mode. Add a check for this before using the skb->hash value as
flow_hash.

Fixes: b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate")
Reported-by: Pete Heist <pete@heistp.net>
Tested-by: Pete Heist <pete@heistp.net>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_cake.c