vswitchd: Fix function prototype of packet_set_ipv6()
[openvswitch] / lib / ofp-util.c
index 5703f8cc03cbf465514ca9d7427f6712d56a4a69..dea4aeafce0ce006e6ec56b69fb9ecba3fd4eee6 100644 (file)
@@ -1080,10 +1080,11 @@ ofputil_format_version_bitmap_names(struct ds *msg, uint32_t bitmap)
 
 static bool
 ofputil_decode_hello_bitmap(const struct ofp_hello_elem_header *oheh,
-                            uint32_t *allowed_versions)
+                            uint32_t *allowed_versionsp)
 {
     uint16_t bitmap_len = ntohs(oheh->length) - sizeof *oheh;
     const ovs_be32 *bitmap = (const ovs_be32 *) (oheh + 1);
+    uint32_t allowed_versions;
 
     if (!bitmap_len || bitmap_len % sizeof *bitmap) {
         return false;
@@ -1094,21 +1095,22 @@ ofputil_decode_hello_bitmap(const struct ofp_hello_elem_header *oheh,
      * should have no effect on session negotiation until Open vSwtich supports
      * wire-protocol versions greater than 31.
      */
-    *allowed_versions = ntohl(bitmap[0]);
+    allowed_versions = ntohl(bitmap[0]);
 
-    if (*allowed_versions & 1) {
+    if (allowed_versions & 1) {
         /* There's no OpenFlow version 0. */
         VLOG_WARN_RL(&bad_ofmsg_rl, "peer claims to support invalid OpenFlow "
                      "version 0x00");
-        *allowed_versions &= ~1u;
+        allowed_versions &= ~1u;
     }
 
-    if (!*allowed_versions) {
+    if (!allowed_versions) {
         VLOG_WARN_RL(&bad_ofmsg_rl, "peer does not support any OpenFlow "
                      "version (between 0x01 and 0x1f)");
         return false;
     }
 
+    *allowed_versionsp = allowed_versions;
     return true;
 }
 
@@ -1186,6 +1188,8 @@ ofputil_encode_hello(uint32_t allowed_versions)
         oheh->type = htons(OFPHET_VERSIONBITMAP);
         oheh->length = htons(map_len + sizeof *oheh);
         *(ovs_be32 *)(oheh + 1) = htonl(allowed_versions);
+
+        ofpmsg_update_length(msg);
     }
 
     return msg;