On May 8, 2012, at 10:47 AM, Ben Pfaff wrote: > On Tue, May 08, 2012 at 10:42:11AM -0700, Justin Pettit wrote: >> Not all ports may fit in a Features Reply, so if that's the case, then >> use the new port description stat message for looking up ports. >> >> Signed-off-by: Justin Pettit <jpet...@nicira.com> > > All I noticed is that in fetch_port_by_stats() we should check that > the reply is actually a port_desc stats reply (perhaps with > ofputil_decode_msg_type()), since right now AFAICT it will try to > interpret an error reply as a stats reply, which probably will work > out badly.
Good point. How about the incremental at the end of the message? --Justin --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -610,8 +610,16 @@ fetch_port_by_stats(const char *vconn_name, run(vconn_recv_block(vconn, &reply), "OpenFlow packet receive failed"); recv_xid = ((struct ofp_header *) reply->data)->xid; if (send_xid == recv_xid) { + const struct ofputil_msg_type *type; struct ofp_stats_msg *osm; + ofputil_decode_msg_type(reply->data, &type); + if (ofputil_msg_type_code(type) != OFPUTIL_OFPST_PORT_DESC_REPLY) { + ovs_fatal(0, "received bad reply: %s", + ofp_to_string(reply->data, reply->size, + verbosity + 1)); + } + osm = ofpbuf_at(reply, 0, sizeof *osm); done = !osm || !(ntohs(osm->flags) & OFPSF_REPLY_MORE); _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev