From: Ben Pfaff Date: Wed, 15 Feb 2012 23:39:41 +0000 (-0800) Subject: ofp-util: Don't decode some OF1.1 messages as OF1.0 stats messages. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7887679be26e75b897494580f280870d9a1fa318;p=openvswitch ofp-util: Don't decode some OF1.1 messages as OF1.0 stats messages. This bug was not yet visible because none of the messages that would be misinterpreted were yet implemented. Reviewed-by: Simon Horman Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 4054e970..77c58515 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -767,16 +767,19 @@ ofputil_decode_msg_type__(const struct ofp_header *oh, size_t length, error = ofputil_lookup_openflow_message(&ofpt_category, oh->version, oh->type, typep); if (!error) { - switch (oh->type) { - case OFPT_VENDOR: + switch ((oh->version << 8) | oh->type) { + case (OFP10_VERSION << 8) | OFPT_VENDOR: + case (OFP11_VERSION << 8) | OFPT_VENDOR: error = ofputil_decode_vendor(oh, length, typep); break; - case OFPT10_STATS_REQUEST: + case (OFP10_VERSION << 8) | OFPT10_STATS_REQUEST: + case (OFP11_VERSION << 8) | OFPT11_STATS_REQUEST: error = ofputil_decode_ofpst_request(oh, length, typep); break; - case OFPT10_STATS_REPLY: + case (OFP10_VERSION << 8) | OFPT10_STATS_REPLY: + case (OFP11_VERSION << 8) | OFPT11_STATS_REPLY: error = ofputil_decode_ofpst_reply(oh, length, typep); default: