diff mbox series

[net] net: vrf: determine the dst using the original ifindex for multicast

Message ID 20221220171825.1172237-1-atenart@kernel.org (mailing list archive)
State Accepted
Commit f2575c8f404911da83f25b688e12afcf4273e640
Delegated to: Netdev Maintainers
Headers show
Series [net] net: vrf: determine the dst using the original ifindex for multicast | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Antoine Tenart Dec. 20, 2022, 5:18 p.m. UTC
Multicast packets received on an interface bound to a VRF are marked as
belonging to the VRF and the skb device is updated to point to the VRF
device itself. This was fine even when a route was associated to a
device as when performing a fib table lookup 'oif' in fib6_table_lookup
(coming from 'skb->dev->ifindex' in ip6_route_input) was set to 0 when
FLOWI_FLAG_SKIP_NH_OIF was set.

With commit 40867d74c374 ("net: Add l3mdev index to flow struct and
avoid oif reset for port devices") this is not longer true and multicast
traffic is not received on the original interface.

Instead of adding back a similar check in fib6_table_lookup determine
the dst using the original ifindex for multicast VRF traffic. To make
things consistent across the function do the above for all strict
packets, which was the logic before commit 6f12fa775530 ("vrf: mark skb
for multicast or link-local as enslaved to VRF"). Note that reverting to
this behavior should be fine as the change was about marking packets
belonging to the VRF, not about their dst.

Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices")
Cc: David Ahern <dsahern@kernel.org>
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Antoine Tenart <atenart@kernel.org>
---
 drivers/net/vrf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Ahern Dec. 20, 2022, 6:58 p.m. UTC | #1
On 12/20/22 10:18 AM, Antoine Tenart wrote:
> Multicast packets received on an interface bound to a VRF are marked as
> belonging to the VRF and the skb device is updated to point to the VRF
> device itself. This was fine even when a route was associated to a
> device as when performing a fib table lookup 'oif' in fib6_table_lookup
> (coming from 'skb->dev->ifindex' in ip6_route_input) was set to 0 when
> FLOWI_FLAG_SKIP_NH_OIF was set.
> 
> With commit 40867d74c374 ("net: Add l3mdev index to flow struct and
> avoid oif reset for port devices") this is not longer true and multicast
> traffic is not received on the original interface.
> 
> Instead of adding back a similar check in fib6_table_lookup determine
> the dst using the original ifindex for multicast VRF traffic. To make
> things consistent across the function do the above for all strict
> packets, which was the logic before commit 6f12fa775530 ("vrf: mark skb
> for multicast or link-local as enslaved to VRF"). Note that reverting to
> this behavior should be fine as the change was about marking packets
> belonging to the VRF, not about their dst.
> 
> Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices")
> Cc: David Ahern <dsahern@kernel.org>
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Signed-off-by: Antoine Tenart <atenart@kernel.org>
> ---
>  drivers/net/vrf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Dec. 22, 2022, 1:50 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 20 Dec 2022 18:18:25 +0100 you wrote:
> Multicast packets received on an interface bound to a VRF are marked as
> belonging to the VRF and the skb device is updated to point to the VRF
> device itself. This was fine even when a route was associated to a
> device as when performing a fib table lookup 'oif' in fib6_table_lookup
> (coming from 'skb->dev->ifindex' in ip6_route_input) was set to 0 when
> FLOWI_FLAG_SKIP_NH_OIF was set.
> 
> [...]

Here is the summary with links:
  - [net] net: vrf: determine the dst using the original ifindex for multicast
    https://git.kernel.org/netdev/net/c/f2575c8f4049

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 6b5a4d036d15..bdb3a76a352e 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -1385,8 +1385,8 @@  static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
 
 	/* loopback, multicast & non-ND link-local traffic; do not push through
 	 * packet taps again. Reset pkt_type for upper layers to process skb.
-	 * For strict packets with a source LLA, determine the dst using the
-	 * original ifindex.
+	 * For non-loopback strict packets, determine the dst using the original
+	 * ifindex.
 	 */
 	if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
 		skb->dev = vrf_dev;
@@ -1395,7 +1395,7 @@  static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
 
 		if (skb->pkt_type == PACKET_LOOPBACK)
 			skb->pkt_type = PACKET_HOST;
-		else if (ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)
+		else
 			vrf_ip6_input_dst(skb, vrf_dev, orig_iif);
 
 		goto out;