ofp-util: Correct length of hello version bitmap
authorSimon Horman <horms@verge.net.au>
Wed, 7 Nov 2012 08:02:59 +0000 (17:02 +0900)
committerBen Pfaff <blp@nicira.com>
Fri, 9 Nov 2012 18:01:41 +0000 (10:01 -0800)
The length of the hello version bitmap is measured in bytes
so the return value of sizeof is sufficient. Dividing
this by CHAR_BIT (=8) seems to be an artifact of reworking
a previous version of this code.

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

index ae54477ee567f50317db0ea6ac1bb3c0d1ac6664..5703f8cc03cbf465514ca9d7427f6712d56a4a69 100644 (file)
@@ -1181,7 +1181,7 @@ ofputil_encode_hello(uint32_t allowed_versions)
         struct ofp_hello_elem_header *oheh;
         uint16_t map_len;
 
-        map_len = sizeof(uint32_t) / CHAR_BIT;
+        map_len = sizeof allowed_versions;
         oheh = ofpbuf_put_zeros(msg, ROUND_UP(map_len + sizeof *oheh, 8));
         oheh->type = htons(OFPHET_VERSIONBITMAP);
         oheh->length = htons(map_len + sizeof *oheh);