]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipv4: use consistent txhash in TIME_WAIT and SYN_RECV
authorAntoine Tenart <atenart@kernel.org>
Tue, 23 May 2023 16:14:52 +0000 (18:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 06:50:44 +0000 (08:50 +0200)
commitf62a00b7d13554b7337582d5e4ce8e1e12283786
treea5d168c2c4c8778df6f0bf88c3756a1869e46a4d
parent1d8e3ec4f0a6a47aed551334642e3d2947ed9377
net: ipv4: use consistent txhash in TIME_WAIT and SYN_RECV

[ Upstream commit c0a8966e2bc7d31f77a7246947ebc09c1ff06066 ]

When using IPv4/TCP, skb->hash comes from sk->sk_txhash except in
TIME_WAIT and SYN_RECV where it's not set in the reply skb from
ip_send_unicast_reply. Those packets will have a mismatched hash with
others from the same flow as their hashes will be 0. IPv6 does not have
the same issue as the hash is set from the socket txhash in those cases.

This commits sets the hash in the reply skb from ip_send_unicast_reply,
which makes the IPv4 code behaving like IPv6.

Signed-off-by: Antoine Tenart <atenart@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 5e5265522a9a ("tcp: annotate data-races around tcp_rsk(req)->txhash")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/ip.h
net/ipv4/ip_output.c
net/ipv4/tcp_ipv4.c