diff options
author | Ben Pfaff <blp@nicira.com> | 2012-02-27 18:42:17 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-02-27 18:44:49 -0800 |
commit | ec9312500e14eda64d1fa7ea15dfa56691992c61 (patch) | |
tree | 168efb787432f37b229f5799ed58c1cfbcdd27fb | |
parent | 266ed172aa587bf8e12c1b1f98c1042011e775ca (diff) |
dpif-linux: Make dpif_linux_port_query_by_name() query only one datapath.
The kernel will report a vport with the given name in any datapath, but
userspace only wants a vport with the given name in a specific datapath.
Receiving information on a vport in an unexpected datapath yields bizarre
and hard-to-debug problems.
Bug #9889.
Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r-- | lib/dpif-linux.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 1f6c2c02..818d86f8 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -457,9 +457,15 @@ dpif_linux_port_query__(const struct dpif *dpif, uint32_t port_no, error = dpif_linux_vport_transact(&request, &reply, &buf); if (!error) { - dpif_port->name = xstrdup(reply.name); - dpif_port->type = xstrdup(netdev_vport_get_netdev_type(&reply)); - dpif_port->port_no = reply.port_no; + if (reply.dp_ifindex != request.dp_ifindex) { + /* A query by name reported that 'port_name' is in some datapath + * other than 'dpif', but the caller wants to know about 'dpif'. */ + error = ENODEV; + } else { + dpif_port->name = xstrdup(reply.name); + dpif_port->type = xstrdup(netdev_vport_get_netdev_type(&reply)); + dpif_port->port_no = reply.port_no; + } ofpbuf_delete(buf); } return error; |