[ovs-dev] [PATCH 2/3] netdev: fetch vport using devname instead of direct from br_port

Wei Yongjun yjwei at cn.fujitsu.com
Thu May 20 05:15:34 UTC 2010


When openvswitch kernel module handle device event notify, it
fetch the vport from dev->br_port. But if dev->br_port is added
by brctl command, not by ovs-vsctl, handle device event will
cause kernel panic. Instead, we can fetch the vport safely by
using devname.

Signed-off-by: Wei Yongjun <yjwei at cn.fujitsu.com>
---
 datapath/vport-netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 8cc4421..826b614 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -353,7 +353,7 @@ netdev_send(struct vport *vport, struct sk_buff *skb)
 struct vport *
 netdev_get_vport(struct net_device *dev)
 {
-	return (struct vport *)dev->br_port;
+	return vport_locate(dev->name);
 }
 
 struct vport_ops netdev_vport_ops = {
-- 
1.6.5.2






More information about the dev mailing list