kernel_samsung_a53x/net/ipv6
Andrea Mayer f379de3e94 net: seg6: fix seg6_lookup_any_nexthop() to handle VRFs using flowi_l3mdev
commit a3bd2102e464202b58d57390a538d96f57ffc361 upstream.

Commit 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif
reset for port devices") adds a new entry (flowi_l3mdev) in the common
flow struct used for indicating the l3mdev index for later rule and
table matching.
The l3mdev_update_flow() has been adapted to properly set the
flowi_l3mdev based on the flowi_oif/flowi_iif. In fact, when a valid
flowi_iif is supplied to the l3mdev_update_flow(), this function can
update the flowi_l3mdev entry only if it has not yet been set (i.e., the
flowi_l3mdev entry is equal to 0).

The SRv6 End.DT6 behavior in VRF mode leverages a VRF device in order to
force the routing lookup into the associated routing table. This routing
operation is performed by seg6_lookup_any_nextop() preparing a flowi6
data structure used by ip6_route_input_lookup() which, in turn,
(indirectly) invokes l3mdev_update_flow().

However, seg6_lookup_any_nexthop() does not initialize the new
flowi_l3mdev entry which is filled with random garbage data. This
prevents l3mdev_update_flow() from properly updating the flowi_l3mdev
with the VRF index, and thus SRv6 End.DT6 (VRF mode)/DT46 behaviors are
broken.

This patch correctly initializes the flowi6 instance allocated and used
by seg6_lookup_any_nexhtop(). Specifically, the entire flowi6 instance
is wiped out: in case new entries are added to flowi/flowi6 (as happened
with the flowi_l3mdev entry), we should no longer have incorrectly
initialized values. As a result of this operation, the value of
flowi_l3mdev is also set to 0.

The proposed fix can be tested easily. Starting from the commit
referenced in the Fixes, selftests [1],[2] indicate that the SRv6
End.DT6 (VRF mode)/DT46 behaviors no longer work correctly. By applying
this patch, those behaviors are back to work properly again.

[1] - tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh
[2] - tools/testing/selftests/net/srv6_end_dt6_l3vpn_test.sh

Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices")
Reported-by: Anton Makarov <am@3a-alliance.com>
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220608091917.20345-1-andrea.mayer@uniroma2.it
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:53 +01:00
..
ila ila: call nf_unregister_net_hooks() sooner 2024-11-23 23:21:00 +01:00
netfilter netfilter: fib: check correct rtable in vrf setups 2024-11-23 23:21:52 +01:00
addrconf.c ipv6: take care of scope when choosing the src addr 2024-11-23 23:20:12 +01:00
addrconf_core.c ipv6: Ensure natural alignment of const ipv6 loopback and router addresses 2024-11-18 12:13:22 +01:00
addrlabel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
af_inet6.c ipv6: annotate some data-races around sk->sk_prot 2024-11-19 14:19:35 +01:00
ah6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
anycast.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
calipso.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
datagram.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
esp6.c net: esp: cleanup esp_output_tail_tcp() in case of unsupported ESPINTCP 2024-11-23 23:20:06 +01:00
esp6_offload.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exthdrs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exthdrs_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exthdrs_offload.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib6_notifier.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fib6_rules.c ipv6: fib6_rules: avoid possible NULL dereference in fib6_rule_action() 2024-11-19 11:32:46 +01:00
fou6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
icmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet6_connection_sock.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inet6_hashtables.c net: remove duplicate reuseport_lookup functions 2024-11-19 12:26:55 +01:00
ip6_checksum.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_fib.c ipv6: fix possible race in __fib6_drop_pcpu_from() 2024-11-19 14:19:01 +01:00
ip6_flowlabel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_gre.c erspan: make sure erspan_base_hdr is present in skb->head 2024-11-19 09:22:47 +01:00
ip6_icmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_input.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_complete handlers 2024-11-23 23:21:04 +01:00
ip6_offload.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_output.c net: Add l3mdev index to flow struct and avoid oif reset for port devices 2024-11-23 23:21:52 +01:00
ip6_tunnel.c ip6_tunnel: Fix broken GRO 2024-11-23 23:20:48 +01:00
ip6_udp_tunnel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6_vti.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ip6mr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipcomp6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipv6_sockglue.c tcp: Fix data races around icsk->icsk_af_ops. 2024-11-19 14:19:35 +01:00
Kconfig net: ipv6: select DST_CACHE from IPV6_RPL_LWTUNNEL 2024-11-23 23:21:28 +01:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mcast.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mcast_snoop.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mip6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ndisc.c ipv6: fix ndisc_is_useropt() handling for PIO 2024-11-23 23:20:20 +01:00
netfilter.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
output_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ping.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
protocol.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reassembly.c net: ipv6: fix wrong start position when receive hop-by-hop fragment 2024-11-19 12:26:56 +01:00
route.c net: Add l3mdev index to flow struct and avoid oif reset for port devices 2024-11-23 23:21:52 +01:00
rpl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rpl_iptunnel.c net: ipv6: rpl_iptunnel: Fix memory leak in rpl_input 2024-11-23 23:21:19 +01:00
seg6.c ipv6: sr: fix invalid unregister error path 2024-11-19 12:26:57 +01:00
seg6_hmac.c ipv6: sr: fix memleak in seg6_hmac_init_algo 2024-11-19 12:27:09 +01:00
seg6_iptunnel.c ipv6: sr: block BH in seg6_output_core() and seg6_input_core() 2024-11-19 14:19:00 +01:00
seg6_local.c net: seg6: fix seg6_lookup_any_nexthop() to handle VRFs using flowi_l3mdev 2024-11-23 23:21:53 +01:00
sit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
syncookies.c dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses. 2024-11-18 11:43:07 +01:00
sysctl_net_ipv6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tcp_ipv6.c tcp: Fix data races around icsk->icsk_af_ops. 2024-11-19 14:19:35 +01:00
tcpv6_offload.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tunnel6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp.c udp: Avoid call to compute_score on multiple sites 2024-11-19 12:26:55 +01:00
udp_impl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
udp_offload.c gro: remove rcu_read_lock/rcu_read_unlock from gro_receive handlers 2024-11-23 23:21:04 +01:00
udplite.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm6_input.c xfrm: Preserve vlan tags for transport mode software GRO 2024-11-19 11:32:45 +01:00
xfrm6_output.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm6_policy.c net: Add l3mdev index to flow struct and avoid oif reset for port devices 2024-11-23 23:21:52 +01:00
xfrm6_protocol.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm6_state.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xfrm6_tunnel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00