[ovs-dev] [PATCH 19/23] datapath: Scrub skb between namespaces

Joe Stringer joestringer at nicira.com
Sat Nov 7 19:59:57 UTC 2015


If OVS receives a packet from another namespace, then the packet should
be scrubbed. However, people have already begun to rely on the behaviour
that skb->mark is preserved across namespaces, so retain this one field.

This is mainly to address information leakage between namespaces when
using OVS internal ports, but by placing it in ovs_vport_receive() it is
more generally applicable, meaning it should not be overlooked if other
port types are allowed to be moved into namespaces in future.

Upstream: 740dbc289155 ("openvswitch: Scrub skb between namespaces")
Signed-off-by: Joe Stringer <joestringer at nicira.com>
---
 datapath/vport.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/datapath/vport.c b/datapath/vport.c
index 0951cbbdb4e6..899119f9f992 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -494,6 +494,15 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
 
 	OVS_CB(skb)->input_vport = vport;
 	OVS_CB(skb)->mru = 0;
+	if (unlikely(dev_net(skb->dev) != ovs_dp_get_net(vport->dp))) {
+		u32 mark;
+
+		mark = skb->mark;
+		skb_scrub_packet(skb, true);
+		skb->mark = mark;
+		tun_info = NULL;
+	}
+
 	ovs_skb_init_inner_protocol(skb);
 	skb_clear_ovs_gso_cb(skb);
 	/* Extract flow from 'skb' into 'key'. */
-- 
2.1.4




More information about the dev mailing list