Skip to content

Commit 9e9b70a

Browse files
wtarreaukuba-moo
authored andcommitted
tcp: use different parts of the port_offset for index and offset
Amit Klein suggests that we use different parts of port_offset for the table's index and the port offset so that there is no direct relation between them. Cc: Jason A. Donenfeld <Jason@zx2c4.com> Cc: Moshe Kol <moshe.kol@mail.huji.ac.il> Cc: Yossi Gilad <yossi.gilad@mail.huji.ac.il> Cc: 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>
1 parent b2d0575 commit 9e9b70a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/ipv4/inet_hashtables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
777777
net_get_random_once(table_perturb, sizeof(table_perturb));
778778
index = hash_32(port_offset, INET_TABLE_PERTURB_SHIFT);
779779

780-
offset = READ_ONCE(table_perturb[index]) + port_offset;
780+
offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32);
781781
offset %= remaining;
782782

783783
/* In first pass we try ports of @low parity.

0 commit comments

Comments
 (0)