android_kernel_xiaomi_sm7250/net/ipv4
Kuniyuki Iwashima 7162f05f1f tcp/udp: Make early_demux back namespacified.
commit 11052589cf5c0bab3b4884d423d5f60c38fcf25d upstream.

Commit e21145a987 ("ipv4: namespacify ip_early_demux sysctl knob") made
it possible to enable/disable early_demux on a per-netns basis.  Then, we
introduced two knobs, tcp_early_demux and udp_early_demux, to switch it for
TCP/UDP in commit dddb64bcb3 ("net: Add sysctl to toggle early demux for
tcp and udp").  However, the .proc_handler() was wrong and actually
disabled us from changing the behaviour in each netns.

We can execute early_demux if net.ipv4.ip_early_demux is on and each proto
.early_demux() handler is not NULL.  When we toggle (tcp|udp)_early_demux,
the change itself is saved in each netns variable, but the .early_demux()
handler is a global variable, so the handler is switched based on the
init_net's sysctl variable.  Thus, netns (tcp|udp)_early_demux knobs have
nothing to do with the logic.  Whether we CAN execute proto .early_demux()
is always decided by init_net's sysctl knob, and whether we DO it or not is
by each netns ip_early_demux knob.

This patch namespacifies (tcp|udp)_early_demux again.  For now, the users
of the .early_demux() handler are TCP and UDP only, and they are called
directly to avoid retpoline.  So, we can remove the .early_demux() handler
from inet6?_protos and need not dereference them in ip6?_rcv_finish_core().
If another proto needs .early_demux(), we can restore it at that time.

Fixes: dddb64bcb3 ("net: Add sysctl to toggle early demux for tcp and udp")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20220713175207.7727-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-10 17:46:54 +01:00
..
bpfilter
netfilter netfilter: nft_fib: Fix for rpath check with VRF devices 2022-10-26 13:19:25 +02:00
af_inet.c tcp/udp: Make early_demux back namespacified. 2022-11-10 17:46:54 +01:00
ah4.c
arp.c ipv4: Invalidate neighbour for broadcast address upon address addition 2022-04-15 14:15:01 +02:00
cipso_ipv4.c cipso: Fix data-races around sysctl. 2022-07-21 21:09:28 +02:00
datagram.c
devinet.c net: return correct error code 2021-12-08 08:50:11 +01:00
esp4_offload.c
esp4.c esp: limit skb_page_frag_refill use to a single page 2022-07-12 16:29:00 +02:00
fib_frontend.c ipv4: Invalidate neighbour for broadcast address upon address addition 2022-04-15 14:15:01 +02:00
fib_lookup.h
fib_notifier.c
fib_rules.c
fib_semantics.c net: Fix the arp error in some cases 2020-06-30 23:17:06 -04:00
fib_trie.c ipv4: Silence suspicious RCU usage warning 2020-08-11 15:32:34 +02:00
fou.c
gre_demux.c erspan: fix version 1 check in gre_parse_header() 2021-01-12 20:10:19 +01:00
gre_offload.c net: gre: recompute gre csum for sctp over gre tunnels 2020-08-11 15:32:34 +02:00
icmp.c icmp: Fix a data-race around sysctl_icmp_ratemask. 2022-07-21 21:09:28 +02:00
igmp.c igmp: Fix data-races around sysctl_igmp_qrv. 2022-08-11 12:48:39 +02:00
inet_connection_sock.c tcp: fix race condition when creating child sockets from syncookies 2022-04-27 13:39:42 +02:00
inet_diag.c inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() 2020-11-24 13:27:16 +01:00
inet_fragment.c
inet_hashtables.c once: add DO_ONCE_SLOW() for sleepable contexts 2022-10-26 13:19:26 +02:00
inet_timewait_sock.c
inetpeer.c inetpeer: Fix data-races around sysctl. 2022-07-21 21:09:27 +02:00
ip_forward.c
ip_fragment.c
ip_gre.c erspan: do not assume transport header is always set 2022-07-02 16:27:32 +02:00
ip_input.c tcp/udp: Make early_demux back namespacified. 2022-11-10 17:46:54 +01:00
ip_options.c
ip_output.c ipv4: tcp: send zero IPID in SYNACK messages 2022-02-08 18:23:11 +01:00
ip_sockglue.c
ip_tunnel_core.c
ip_tunnel.c net: ip_tunnel: fix mtu calculation for ETHER tunnel devices 2021-07-28 11:13:46 +02:00
ip_vti.c ip_vti: receive ipip packet by calling ip_tunnel_rcv 2020-06-03 08:19:46 +02:00
ipcomp.c
ipconfig.c net: ipconfig: Don't override command-line hostnames or domains 2021-06-30 08:48:13 -04:00
ipip.c net: ipip: fix wrong address family in init error path 2020-06-03 08:19:10 +02:00
ipmr_base.c
ipmr.c ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path 2022-02-16 12:51:45 +01:00
Kconfig vti[6]: fix packet tx through bpf_redirect() in XinY cases 2020-04-02 15:28:18 +02:00
Makefile
metrics.c
netfilter.c netfilter: use actual socket sk rather than skb sk when routing harder 2020-11-18 19:18:44 +01:00
netlink.c
ping.c ping: fix address binding wrt vrf 2022-05-18 09:42:50 +02:00
proc.c
protocol.c
raw_diag.c
raw.c net: add missing SOF_TIMESTAMPING_OPT_ID support 2022-04-15 14:15:04 +02:00
route.c ip: Fix data-races around sysctl_ip_fwd_use_pmtu. 2022-07-29 17:10:31 +02:00
syncookies.c tcp: make sure treq->af_specific is initialized 2022-05-12 12:20:25 +02:00
sysctl_net_ipv4.c tcp/udp: Make early_demux back namespacified. 2022-11-10 17:46:54 +01:00
tcp_bbr.c tcp_bbr: fix u32 wrap bug in round logic if bbr_init() called after 2B packets 2021-08-26 08:36:39 -04:00
tcp_bic.c
tcp_cdg.c
tcp_cong.c net: Only allow init netns to set default tcp cong to a restricted algo 2021-05-22 10:59:39 +02:00
tcp_cubic.c tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows 2021-12-01 09:27:43 +01:00
tcp_dctcp.c
tcp_diag.c tcp: annotate tp->write_seq lockless reads 2021-03-17 16:43:43 +01:00
tcp_fastopen.c tcp: Fix data-races around sysctl_tcp_fastopen. 2022-07-29 17:10:33 +02:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: fix indefinite deferral of RTO with SACK reneging 2022-11-03 23:52:31 +09:00
tcp_ipv4.c inet: fully convert sk->sk_rx_dst to RCU rules 2022-10-26 13:19:42 +02:00
tcp_lp.c
tcp_metrics.c tcp: Fix a data-race around sysctl_tcp_nometrics_save. 2022-08-11 12:48:39 +02:00
tcp_minisocks.c tcp: Fix a data-race around sysctl_tcp_rfc1337. 2022-07-29 17:10:34 +02:00
tcp_nv.c
tcp_offload.c
tcp_output.c tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited 2022-10-26 13:19:26 +02:00
tcp_rate.c
tcp_recovery.c tcp: Fix data-races around sysctl_tcp_recovery. 2022-07-29 17:10:33 +02:00
tcp_scalable.c
tcp_timer.c tcp: Fix a data-race around sysctl_tcp_thin_linear_timeouts. 2022-07-29 17:10:33 +02:00
tcp_ulp.c
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tcp.c inet: fully convert sk->sk_rx_dst to RCU rules 2022-10-26 13:19:42 +02:00
tunnel4.c
udp_diag.c
udp_impl.h
udp_offload.c net: Fix gro aggregation for udp encaps with zero csum 2021-03-17 16:43:42 +01:00
udp_tunnel.c
udp.c inet: fully convert sk->sk_rx_dst to RCU rules 2022-10-26 13:19:42 +02:00
udplite.c
xfrm4_input.c
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c
xfrm4_output.c xfrm: Always set XFRM_TRANSFORMED in xfrm{4,6}_output_finish 2020-04-29 16:31:23 +02:00
xfrm4_policy.c xfrm: Don't accidentally set RTO_ONLINK in decode_session4() 2022-02-23 11:58:39 +01:00
xfrm4_protocol.c net: xfrm: unexport __init-annotated xfrm4_protocol_init() 2022-06-14 16:59:35 +02:00
xfrm4_state.c
xfrm4_tunnel.c