ofp-util: Correct length of hello version bitmap
[openvswitch] / lib / ofp-util.c
index 146e538a7f464ef6e92969f6018d93e528b09e3a..5703f8cc03cbf465514ca9d7427f6712d56a4a69 100644 (file)
@@ -1043,7 +1043,7 @@ ofputil_usable_protocols(const struct match *match)
 void
 ofputil_format_version(struct ds *msg, enum ofp_version version)
 {
-    ds_put_format(msg, "0x%02zx", version);
+    ds_put_format(msg, "0x%02x", version);
 }
 
 void
@@ -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);