aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-04-15 21:03:27 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-16 14:20:40 -0400
commit213dd74aee765d4e5f3f4b9607fef0cf97faa2af (patch)
treecdc47056012c571b67249a68129dee21886cf6f4 /net
parent4c0ee414e877b899f7fc80aafb98d9425c02797f (diff)
skbuff: Do not scrub skb mark within the same name space
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 ea23192e8e577dfc51e0f4fc5ca113af334edff9 ("tunnels: > Maybe add a Fixes tag? > Fixes: ea23192e8e57 ("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 ea23192e8e577dfc51e0f4fc5ca113af334edff9 ("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: ea23192e8e57 ("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>
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f9800f4059b4..d1967dab9cc6 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4124,18 +4124,21 @@ EXPORT_SYMBOL(skb_try_coalesce);
4124 */ 4124 */
4125void skb_scrub_packet(struct sk_buff *skb, bool xnet) 4125void skb_scrub_packet(struct sk_buff *skb, bool xnet)
4126{ 4126{
4127 if (xnet)
4128 skb_orphan(skb);
4129 skb->tstamp.tv64 = 0; 4127 skb->tstamp.tv64 = 0;
4130 skb->pkt_type = PACKET_HOST; 4128 skb->pkt_type = PACKET_HOST;
4131 skb->skb_iif = 0; 4129 skb->skb_iif = 0;
4132 skb->ignore_df = 0; 4130 skb->ignore_df = 0;
4133 skb_dst_drop(skb); 4131 skb_dst_drop(skb);
4134 skb->mark = 0;
4135 skb_sender_cpu_clear(skb); 4132 skb_sender_cpu_clear(skb);
4136 secpath_reset(skb); 4133 secpath_reset(skb);
4137 nf_reset(skb); 4134 nf_reset(skb);
4138 nf_reset_trace(skb); 4135 nf_reset_trace(skb);
4136
4137 if (!xnet)
4138 return;
4139
4140 skb_orphan(skb);
4141 skb->mark = 0;
4139} 4142}
4140EXPORT_SYMBOL_GPL(skb_scrub_packet); 4143EXPORT_SYMBOL_GPL(skb_scrub_packet);
4141 4144