]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 May 2022 02:22:33 +0000 (19:22 -0700)
commit4fbcb8f5b3b585a812b76a0ef02a287b665b0be4
tree57699c177cf0115d66ca9dc3eec9666d9f0a415d
parent85bf0dc6b58d5fb4430ba6e5e026cc79fb3b134d
tcp: drop the hash_32() part from the index calculation

In commit 57c2c1517858 ("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>
net/ipv4/inet_hashtables.c