We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a870ea commit 688984fCopy full SHA for 688984f
net/mptcp/syncookies.c
@@ -37,7 +37,21 @@ static spinlock_t join_entry_locks[COOKIE_JOIN_SLOTS] __cacheline_aligned_in_smp
37
38
static u32 mptcp_join_entry_hash(struct sk_buff *skb, struct net *net)
39
{
40
- u32 i = skb_get_hash(skb) ^ net_hash_mix(net);
+ static u32 mptcp_join_hash_secret __read_mostly;
41
+ struct tcphdr *th = tcp_hdr(skb);
42
+ u32 seq, i;
43
+
44
+ net_get_random_once(&mptcp_join_hash_secret,
45
+ sizeof(mptcp_join_hash_secret));
46
47
+ if (th->syn)
48
+ seq = TCP_SKB_CB(skb)->seq;
49
+ else
50
+ seq = TCP_SKB_CB(skb)->seq - 1;
51
52
+ i = jhash_3words(seq, net_hash_mix(net),
53
+ (__force __u32)th->source << 16 | (__force __u32)th->dest,
54
+ mptcp_join_hash_secret);
55
56
return i % ARRAY_SIZE(join_entries);
57
}
0 commit comments