]> git.baikalelectronics.ru Git - kernel.git/commit
dev_forward_skb: do not scrub skb mark within the same name space
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Thu, 24 Jun 2021 08:05:05 +0000 (10:05 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Jun 2021 18:04:39 +0000 (11:04 -0700)
commit9125184560ea17fb733e4c3a9a4ab8e656b81b05
tree0271645465d1680a127b48238d9d355d9753c114
parent137d2ce1498299bfae753249b5b0105aa347d8fb
dev_forward_skb: do not scrub skb mark within the same name space

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 07967f32b79f ("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
cc863072cc24 ("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
7db3198e75cc ("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>
include/linux/netdevice.h