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)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 25 May 2023 11:20:45 +0000 (13:20 +0200)
commitc0a8966e2bc7d31f77a7246947ebc09c1ff06066
tree52fd9e64f7a2566975c59c826c066f4b379d3ec2
parent4fbfde4e272065943cbcf2d016f0679456cb4f75
net: ipv4: use consistent txhash in TIME_WAIT and SYN_RECV

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>
include/net/ip.h
net/ipv4/ip_output.c
net/ipv4/tcp_ipv4.c