ofp-util: Don't decode some OF1.1 messages as OF1.0 stats messages.
authorBen Pfaff <blp@nicira.com>
Wed, 15 Feb 2012 23:39:41 +0000 (15:39 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 7 Mar 2012 22:05:09 +0000 (14:05 -0800)
This bug was not yet visible because none of the messages that would be
misinterpreted were yet implemented.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-util.c

index 4054e9705a55046847d7eb7da294df7416565df9..77c58515cfa6337425b8575858930eda96b0af67 100644 (file)
@@ -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: