Skip to content

Commit 3365afd

Browse files
pmachatakuba-moo
authored andcommitted
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: 7bc570c ("[IPV6] MROUTE: Support multicast forwarding.") Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Reviewed-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/3141ae8386fbe13fef4b793faa75e6bae58d798a.1750113335.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f78c75d commit 3365afd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv6/ip6mr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,7 @@ static int ip6mr_forward2(struct net *net, struct mr_table *mrt,
20392039
struct sk_buff *skb, int vifi)
20402040
{
20412041
struct vif_device *vif = &mrt->vif_table[vifi];
2042+
struct net_device *indev = skb->dev;
20422043
struct net_device *vif_dev;
20432044
struct ipv6hdr *ipv6h;
20442045
struct dst_entry *dst;
@@ -2101,7 +2102,7 @@ static int ip6mr_forward2(struct net *net, struct mr_table *mrt,
21012102
IP6CB(skb)->flags |= IP6SKB_FORWARDED;
21022103

21032104
return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD,
2104-
net, NULL, skb, skb->dev, vif_dev,
2105+
net, NULL, skb, indev, skb->dev,
21052106
ip6mr_forward2_finish);
21062107

21072108
out_free:

0 commit comments

Comments
 (0)