From 7887679be26e75b897494580f280870d9a1fa318 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 15 Feb 2012 15:39:41 -0800 Subject: [PATCH] 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 --- lib/ofp-util.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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: -- 2.30.2