summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2021-06-24 10:05:05 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-25 11:16:37 +0200
commit0be01dc898df6a2f7c4f19d70af9a7e8c99bf264 (patch)
treeba77f9d1aeceabe75ee39e6f5a147bbaf8bc1dd3 /include/linux
parent3719d3c36aa853d5a2401af9f8d6b116c91ad5ae (diff)
downloadlinux-stable-0be01dc898df6a2f7c4f19d70af9a7e8c99bf264.tar.gz
linux-stable-0be01dc898df6a2f7c4f19d70af9a7e8c99bf264.tar.bz2
linux-stable-0be01dc898df6a2f7c4f19d70af9a7e8c99bf264.zip
dev_forward_skb: do not scrub skb mark within the same name space
commit ff70202b2d1ad522275c6aadc8c53519b6a22c57 upstream. The goal is to keep the mark during a bpf_redirect(), like it is done for legacy encapsulation / decapsulation, when there is no x-netns. This was initially done in commit 213dd74aee76 ("skbuff: Do not scrub skb mark within the same name space"). When the call to skb_scrub_packet() was added in dev_forward_skb() (commit 8b27f27797ca ("skb: allow skb_scrub_packet() to be used by tunnels")), the second argument (xnet) was set to true to force a call to skb_orphan(). At this time, the mark was always cleanned up by skb_scrub_packet(), whatever xnet value was. This call to skb_orphan() was removed later in commit 9c4c325252c5 ("skbuff: preserve sock reference when scrubbing the skb."). But this 'true' stayed here without any real reason. Let's correctly set xnet in ____dev_forward_skb(), this function has access to the previous interface and to the new interface. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net> Cc: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e977118111f6..744017475b1d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3661,7 +3661,7 @@ static __always_inline int ____dev_forward_skb(struct net_device *dev,
return NET_RX_DROP;
}
- skb_scrub_packet(skb, true);
+ skb_scrub_packet(skb, !net_eq(dev_net(dev), dev_net(skb->dev)));
skb->priority = 0;
return 0;
}