android_kernel_xiaomi_sm8350/net/ipv4
Mike Manning b723b34a98 net: prefer socket bound to interface when not in VRF
[ Upstream commit 8d6c414cd2fb74aa6812e9bfec6178f8246c4f3a ]

The commit 6da5b0f027 ("net: ensure unbound datagram socket to be
chosen when not in a VRF") modified compute_score() so that a device
match is always made, not just in the case of an l3mdev skb, then
increments the score also for unbound sockets. This ensures that
sockets bound to an l3mdev are never selected when not in a VRF.
But as unbound and bound sockets are now scored equally, this results
in the last opened socket being selected if there are matches in the
default VRF for an unbound socket and a socket bound to a dev that is
not an l3mdev. However, handling prior to this commit was to always
select the bound socket in this case. Reinstate this handling by
incrementing the score only for bound sockets. The required isolation
due to choosing between an unbound socket and a socket bound to an
l3mdev remains in place due to the device match always being made.
The same approach is taken for compute_score() for stream sockets.

Fixes: 6da5b0f027 ("net: ensure unbound datagram socket to be chosen when not in a VRF")
Fixes: e78190581a ("net: ensure unbound stream socket to be chosen when not in a VRF")
Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/cf0a8523-b362-1edf-ee78-eef63cbbb428@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-13 10:08:20 +02:00
..
bpfilter
netfilter netfilter: arp_tables: add pre_exit hook for table unregister 2021-04-21 12:56:16 +02:00
af_inet.c
ah4.c
arp.c
cipso_ipv4.c net: ipv4: fix memory leak in netlbl_cipsov4_add_std 2021-06-23 14:41:24 +02:00
datagram.c
devinet.c net: ipv4: Remove unneed BUG() function 2021-06-30 08:47:46 -04:00
esp4_offload.c esp: delete NETIF_F_SCTP_CRC bit from features for esp offload 2021-04-14 08:24:13 +02:00
esp4.c xfrm: xfrm_state_mtu should return at least 1280 for ipv6 2021-07-14 16:53:26 +02:00
fib_frontend.c net/ipv4: swap flow ports when validating source 2021-07-14 16:53:31 +02:00
fib_lookup.h
fib_notifier.c
fib_rules.c
fib_semantics.c net: ipv4: Fix rtnexthop len when RTA_FLOW is present 2021-10-06 15:42:33 +02:00
fib_trie.c
fou.c
gre_demux.c
gre_offload.c
icmp.c ipv4/icmp: l3mdev: Perform icmp error route lookup on source device routing table (v2) 2021-09-12 08:56:40 +02:00
igmp.c igmp: Add ip_mc_list lock in ip_check_mc_rcu 2021-09-12 08:56:40 +02:00
inet_connection_sock.c tcp: relookup sock for RST+ACK packets handled by obsolete req sock 2021-03-30 14:35:26 +02:00
inet_diag.c
inet_fragment.c
inet_hashtables.c net: prefer socket bound to interface when not in VRF 2021-10-13 10:08:20 +02:00
inet_timewait_sock.c
inetpeer.c
ip_forward.c
ip_fragment.c
ip_gre.c ip_gre: validate csum_start only on pull 2021-09-22 12:26:45 +02:00
ip_input.c
ip_options.c
ip_output.c ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs() 2021-09-22 12:26:29 +02:00
ip_sockglue.c
ip_tunnel_core.c
ip_tunnel.c net: Set true network header for ECN decapsulation 2021-08-04 12:27:39 +02:00
ip_vti.c
ipcomp.c
ipconfig.c net: ipconfig: Don't override command-line hostnames or domains 2021-06-18 09:58:59 +02:00
ipip.c
ipmr_base.c
ipmr.c
Kconfig
Makefile
metrics.c
netfilter.c
netlink.c
nexthop.c Set fc_nlinfo in nh_create_ipv4, nh_create_ipv6 2021-09-22 12:26:44 +02:00
ping.c ping: Check return value of function 'ping_queue_rcv_skb' 2021-06-30 08:47:47 -04:00
proc.c
protocol.c
raw_diag.c
raw.c
route.c ipv4: fix endianness issue in inet_rtm_getroute_build_skb() 2021-09-15 09:47:38 +02:00
syncookies.c
sysctl_net_ipv4.c
tcp_bbr.c tcp_bbr: fix u32 wrap bug in round logic if bbr_init() called after 2B packets 2021-08-18 08:57:01 +02:00
tcp_bic.c
tcp_bpf.c bpf, sockmap, tcp: sk_prot needs inuse_idx set for proc stats 2021-07-28 13:30:55 +02:00
tcp_cdg.c
tcp_cong.c net: Only allow init netns to set default tcp cong to a restricted algo 2021-05-14 09:44:33 +02:00
tcp_cubic.c
tcp_dctcp.c
tcp_dctcp.h
tcp_diag.c
tcp_fastopen.c tcp: enable data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD 2021-09-22 12:26:33 +02:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c tcp: fix tp->undo_retrans accounting in tcp_sacktag_one() 2021-09-22 12:26:42 +02:00
tcp_ipv4.c tcp: seq_file: Avoid skipping sk during tcp_seek_last_pos 2021-09-15 09:47:32 +02:00
tcp_lp.c
tcp_metrics.c
tcp_minisocks.c tcp: relookup sock for RST+ACK packets handled by obsolete req sock 2021-03-30 14:35:26 +02:00
tcp_nv.c
tcp_offload.c net, gro: Set inner transport header offset in tcp/udp GRO hook 2021-08-12 13:20:56 +02:00
tcp_output.c ipv6: tcp: drop silly ICMPv6 packet too big messages 2021-07-25 14:35:15 +02:00
tcp_rate.c
tcp_recovery.c tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN 2021-02-03 23:26:02 +01:00
tcp_scalable.c
tcp_timer.c tcp: make TCP_USER_TIMEOUT accurate for zero window probes 2021-02-07 15:35:47 +01:00
tcp_ulp.c
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c
tcp.c tcp: add sanity tests to TCP_QUEUE_SEQ 2021-03-17 17:03:32 +01:00
tunnel4.c
udp_diag.c
udp_impl.h
udp_offload.c net, gro: Set inner transport header offset in tcp/udp GRO hook 2021-08-12 13:20:56 +02:00
udp_tunnel.c
udp.c net: prefer socket bound to interface when not in VRF 2021-10-13 10:08:20 +02:00
udplite.c
xfrm4_input.c
xfrm4_output.c
xfrm4_policy.c
xfrm4_protocol.c
xfrm4_state.c
xfrm4_tunnel.c