From 24ce832d5e076e5686b15d2aadd39e8c0818e932 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 7 Mar 2012 14:11:09 -0800 Subject: [PATCH] datapath: Honor dp_ifindex, when specified, for vport lookup by name. When OVS_VPORT_ATTR_NAME is specified and dp_ifindex is nonzero, the logical behavior would be for the vport name lookup scope to be limited to the specified datapath, but in fact the dp_ifindex value was ignored. This commit causes the search scope to be honored. Bug #9889. Signed-off-by: Ben Pfaff Acked-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/datapath.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datapath/datapath.c b/datapath/datapath.c index 23fb1dc8..bb969673 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1729,6 +1729,9 @@ static struct vport *lookup_vport(struct net *net, vport = ovs_vport_locate(net, nla_data(a[OVS_VPORT_ATTR_NAME])); if (!vport) return ERR_PTR(-ENODEV); + if (ovs_header->dp_ifindex && + ovs_header->dp_ifindex != get_dpifindex(vport->dp)) + return ERR_PTR(-ENODEV); return vport; } else if (a[OVS_VPORT_ATTR_PORT_NO]) { u32 port_no = nla_get_u32(a[OVS_VPORT_ATTR_PORT_NO]); -- 2.30.2