linux-stable/net/ipv4
Philo Lu 644f9108f3 udp: Make rehash4 independent in udp_lib_rehash()
As discussed in [0], rehash4 could be missed in udp_lib_rehash() when
udp hash4 changes while hash2 doesn't change. This patch fixes this by
moving rehash4 codes out of rehash2 checking, and then rehash2 and
rehash4 are done separately.

By doing this, we no longer need to call rehash4 explicitly in
udp_lib_hash4(), as the rehash callback in __ip4_datagram_connect takes
it. Thus, now udp_lib_hash4() returns directly if the sk is already
hashed.

Note that uhash4 may fail to work under consecutive connect(<dst
address>) calls because rehash() is not called with every connect(). To
overcome this, connect(<AF_UNSPEC>) needs to be called after the next
connect to a new destination.

[0]
https://lore.kernel.org/all/4761e466ab9f7542c68cdc95f248987d127044d2.1733499715.git.pabeni@redhat.com/

Fixes: 78c91ae2c6 ("ipv4/udp: Add 4-tuple hash for connected socket")
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Philo Lu <lulie@linux.alibaba.com>
Link: https://patch.msgid.link/20250110010810.107145-1-lulie@linux.alibaba.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-01-14 10:44:10 +01:00
..
netfilter
af_inet.c
ah4.c
arp.c
bpf_tcp_ca.c
cipso_ipv4.c
datagram.c udp: fix l4 hash after reconnect 2024-12-10 15:30:36 +01:00
devinet.c
esp4_offload.c
esp4.c
fib_frontend.c
fib_lookup.h
fib_notifier.c
fib_rules.c
fib_semantics.c
fib_trie.c
fou_bpf.c
fou_core.c
fou_nl.c
fou_nl.h
gre_demux.c
gre_offload.c
icmp.c net: Fix icmp host relookup triggering ip_rt_bug 2024-11-30 14:17:10 -08:00
igmp.c
inet_connection_sock.c tcp: Fix use-after-free of nreq in reqsk_timer_handler(). 2024-11-28 09:48:00 +01:00
inet_diag.c
inet_fragment.c
inet_hashtables.c
inet_timewait_sock.c
inetpeer.c
ip_forward.c
ip_fragment.c
ip_gre.c
ip_input.c
ip_options.c
ip_output.c
ip_sockglue.c
ip_tunnel_core.c
ip_tunnel.c net: Fix netns for ip_tunnel_init_flow() 2024-12-23 10:04:41 -08:00
ip_vti.c
ipcomp.c
ipconfig.c
ipip.c
ipmr_base.c
ipmr.c ipmr: tune the ipmr_can_free_table() checks. 2024-12-04 18:49:16 -08:00
Kconfig
Makefile
metrics.c
netfilter.c
netlink.c
nexthop.c
ping.c
proc.c
protocol.c
raw_diag.c
raw.c
route.c ipv4: route: fix drop reason being overridden in ip_route_input_slow 2025-01-09 18:03:24 -08:00
syncookies.c
sysctl_net_ipv4.c
tcp_ao.c
tcp_bbr.c
tcp_bic.c
tcp_bpf.c tcp_bpf: Fix copied value in tcp_bpf_sendmsg 2024-12-20 22:53:36 +01:00
tcp_cdg.c
tcp_cong.c
tcp_cubic.c
tcp_dctcp.c
tcp_dctcp.h
tcp_diag.c
tcp_fastopen.c
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c net: fix memory leak in tcp_conn_request() 2024-12-23 10:03:12 -08:00
tcp_ipv4.c tcp: Annotate data-race around sk->sk_mark in tcp_v4_send_reset 2025-01-08 10:22:02 -08:00
tcp_lp.c
tcp_metrics.c
tcp_minisocks.c tcp: populate XPS related fields of timewait sockets 2024-11-30 13:00:52 -08:00
tcp_nv.c
tcp_offload.c
tcp_output.c tcp: check space before adding MPTCP SYN options 2024-12-10 18:26:52 -08:00
tcp_plb.c
tcp_rate.c
tcp_recovery.c
tcp_scalable.c
tcp_sigpool.c
tcp_timer.c
tcp_ulp.c
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tcp.c
tunnel4.c
udp_bpf.c
udp_diag.c
udp_impl.h
udp_offload.c
udp_tunnel_core.c
udp_tunnel_nic.c
udp_tunnel_stub.c
udp.c udp: Make rehash4 independent in udp_lib_rehash() 2025-01-14 10:44:10 +01:00
udplite.c
xfrm4_input.c
xfrm4_output.c
xfrm4_policy.c
xfrm4_protocol.c
xfrm4_state.c
xfrm4_tunnel.c