tcp: drop the hash_32() part from the index calculation
authorWilly Tarreau <w@1wt.eu>
Mon, 2 May 2022 08:46:14 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 May 2022 08:26:53 +0000 (10:26 +0200)
commitf26c6f9404e1d6f3bfc9780ffba82a01a595d147
tree3dec9d5b0934249ada418fb50ba5f3c56180e57e
parent952a238d779eea4ecb2f8deb5004c8f56be79bc9
tcp: drop the hash_32() part from the index calculation

[ Upstream commit e8161345ddbb66e449abde10d2fdce93f867eba9 ]

In commit 190cc82489f4 ("tcp: change source port randomizarion at
connect() time"), the table_perturb[] array was introduced and an
index was taken from the port_offset via hash_32(). But it turns
out that hash_32() performs a multiplication while the input here
comes from the output of SipHash in secure_seq, that is well
distributed enough to avoid the need for yet another hash.

Suggested-by: Amit Klein <aksecurity@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/inet_hashtables.c