netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net-next] net: clear skb->priority when forwarding to another netns
@ 2015-03-20 21:29 Cong Wang
  2015-03-23 20:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2015-03-20 21:29 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang

skb->priority can be set for two purposes:

1) With respect to IP TOS field, which is computed by a mask.
Ususally used for priority qdisc's (pfifo, prio etc.), on TX
side (we only have ingress qdisc on RX side).

2) Used as a classid or flowid, works in the same way with tc
classid. What's more, this can even override the classid
of tc filters.

For case 1), it has been respected within its netns, I don't
see any point of keeping it for another netns, especially
when packets will be forwarded to Rx path (no matter from TX
path or RX path).

For case 2) we care, our applications run inside a netns,
and we classify the packets by our own filters outside,
If some application sets this priority, it could bypass
our filters, therefore clear it when moving out of a netns,
it makes no sense to bypass tc filters out of its netns.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/core/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 5d43e01..a0408d4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1696,6 +1696,7 @@ int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 	}
 
 	skb_scrub_packet(skb, true);
+	skb->priority = 0;
 	skb->protocol = eth_type_trans(skb, dev);
 	skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch net-next] net: clear skb->priority when forwarding to another netns
  2015-03-20 21:29 [Patch net-next] net: clear skb->priority when forwarding to another netns Cong Wang
@ 2015-03-23 20:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-03-23 20:43 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 20 Mar 2015 14:29:09 -0700

> skb->priority can be set for two purposes:
> 
> 1) With respect to IP TOS field, which is computed by a mask.
> Ususally used for priority qdisc's (pfifo, prio etc.), on TX
> side (we only have ingress qdisc on RX side).
> 
> 2) Used as a classid or flowid, works in the same way with tc
> classid. What's more, this can even override the classid
> of tc filters.
> 
> For case 1), it has been respected within its netns, I don't
> see any point of keeping it for another netns, especially
> when packets will be forwarded to Rx path (no matter from TX
> path or RX path).
> 
> For case 2) we care, our applications run inside a netns,
> and we classify the packets by our own filters outside,
> If some application sets this priority, it could bypass
> our filters, therefore clear it when moving out of a netns,
> it makes no sense to bypass tc filters out of its netns.
> 
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, t hanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 21:29 [Patch net-next] net: clear skb->priority when forwarding to another netns Cong Wang
2015-03-23 20:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).