Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ipv6: ip6mr: Fix in/out netdev to pass to the FORWARD chain

The netfilter hook is invoked with skb->dev for input netdevice, and
vif_dev for output netdevice. However at the point of invocation, skb->dev
is already set to vif_dev, and MR-forwarded packets are reported with
in=out:

# ip6tables -A FORWARD -j LOG --log-prefix '[forw]'
# cd tools/testing/selftests/net/forwarding
# ./router_multicast.sh
# dmesg | fgrep '[forw]'
[ 1670.248245] [forw]IN=v5 OUT=v5 [...]

For reference, IPv4 MR code shows in and out as appropriate.
Fix by caching skb->dev and using the updated value for output netdev.

Fixes: 7bc570c8b4f7 ("[IPV6] MROUTE: Support multicast forwarding.")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/3141ae8386fbe13fef4b793faa75e6bae58d798a.1750113335.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
3365afd3 f78c75d8

+2 -1
+2 -1
net/ipv6/ip6mr.c
··· 2039 2039 struct sk_buff *skb, int vifi) 2040 2040 { 2041 2041 struct vif_device *vif = &mrt->vif_table[vifi]; 2042 + struct net_device *indev = skb->dev; 2042 2043 struct net_device *vif_dev; 2043 2044 struct ipv6hdr *ipv6h; 2044 2045 struct dst_entry *dst; ··· 2102 2101 IP6CB(skb)->flags |= IP6SKB_FORWARDED; 2103 2102 2104 2103 return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD, 2105 - net, NULL, skb, skb->dev, vif_dev, 2104 + net, NULL, skb, indev, skb->dev, 2106 2105 ip6mr_forward2_finish); 2107 2106 2108 2107 out_free: