]> git.ipfire.org Git - thirdparty/linux.git/commit
ipv6: switch inet6_acaddr_hash() to less predictable hash
authorEric Dumazet <edumazet@google.com>
Tue, 8 Oct 2024 12:13:07 +0000 (12:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Oct 2024 02:33:57 +0000 (19:33 -0700)
commit4daf4dc275f1aa3b9629334c4185d62b7bdff1c4
treef3edd15150405eeb07221cc3e9b9682bee9a64aa
parent4a0ec2aa0704c8271fde33a0f7bb92d09c066c17
ipv6: switch inet6_acaddr_hash() to less predictable hash

commit 2384d02520ff ("net/ipv6: Add anycast addresses to a global hashtable")
added inet6_acaddr_hash(), using ipv6_addr_hash() and net_hash_mix()
to get hash spreading for typical users.

However ipv6_addr_hash() is highly predictable and a malicious user
could abuse a specific hash bucket.

Switch to __ipv6_addr_jhash(). We could use a dedicated
secret, or reuse net_hash_mix() as I did in this patch.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241008121307.800040-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/anycast.c