Skip to content

Commit ca7c7b9

Browse files
herbertxsashalevin
authored andcommitted
skbuff: Do not scrub skb mark within the same name space
[ Upstream commit 213dd74 ] On Wed, Apr 15, 2015 at 05:41:26PM +0200, Nicolas Dichtel wrote: > Le 15/04/2015 15:57, Herbert Xu a écrit : > >On Wed, Apr 15, 2015 at 06:22:29PM +0800, Herbert Xu wrote: > [snip] > >Subject: skbuff: Do not scrub skb mark within the same name space > > > >The commit ea23192 ("tunnels: > Maybe add a Fixes tag? > Fixes: ea23192 ("tunnels: harmonize cleanup done on skb on rx path") > > >harmonize cleanup done on skb on rx path") broke anyone trying to > >use netfilter marking across IPv4 tunnels. While most of the > >fields that are cleared by skb_scrub_packet don't matter, the > >netfilter mark must be preserved. > > > >This patch rearranges skb_scurb_packet to preserve the mark field. > nit: s/scurb/scrub > > Else it's fine for me. Sure. PS I used the wrong email for James the first time around. So let me repeat the question here. Should secmark be preserved or cleared across tunnels within the same name space? In fact, do our security models even support name spaces? ---8<--- The commit ea23192 ("tunnels: harmonize cleanup done on skb on rx path") broke anyone trying to use netfilter marking across IPv4 tunnels. While most of the fields that are cleared by skb_scrub_packet don't matter, the netfilter mark must be preserved. This patch rearranges skb_scrub_packet to preserve the mark field. Fixes: ea23192 ("tunnels: harmonize cleanup done on skb on rx path") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent efca6fa commit ca7c7b9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎net/core/skbuff.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,17 +4033,20 @@ EXPORT_SYMBOL(skb_try_coalesce);
40334033
*/
40344034
void skb_scrub_packet(struct sk_buff *skb, bool xnet)
40354035
{
4036-
if (xnet)
4037-
skb_orphan(skb);
40384036
skb->tstamp.tv64 = 0;
40394037
skb->pkt_type = PACKET_HOST;
40404038
skb->skb_iif = 0;
40414039
skb->ignore_df = 0;
40424040
skb_dst_drop(skb);
4043-
skb->mark = 0;
40444041
secpath_reset(skb);
40454042
nf_reset(skb);
40464043
nf_reset_trace(skb);
4044+
4045+
if (!xnet)
4046+
return;
4047+
4048+
skb_orphan(skb);
4049+
skb->mark = 0;
40474050
}
40484051
EXPORT_SYMBOL_GPL(skb_scrub_packet);
40494052

0 commit comments

Comments
 (0)