]> git.proxmox.com Git - mirror_ovs.git/commitdiff
vconn: Update length of bundled messages.
authorJarno Rajahalme <jarno@ovn.org>
Fri, 29 Jul 2016 23:52:03 +0000 (16:52 -0700)
committerJarno Rajahalme <jarno@ovn.org>
Fri, 29 Jul 2016 23:52:03 +0000 (16:52 -0700)
Variable length messages need their length updated before they can be
added to the bundle.

Message length updating after encoding is sometimes done by the
encoding function, but always latest when the message is sent out.  As
an OpenFlow message is added to a bundle add message, it will not be
sent by itself, and we need to update the length explicitly instead.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
lib/ofp-util.c
lib/vconn.c

index 6d73e694ae0325bc8429a57ec7cf0ffab6edd45b..06b48b8f23b17642978eca9198fa0783e173ea2f 100644 (file)
@@ -10011,13 +10011,14 @@ ofputil_encode_bundle_add(enum ofp_version ofp_version,
     request = ofpraw_alloc_xid(ofp_version == OFP13_VERSION
                                ? OFPRAW_ONFT13_BUNDLE_ADD_MESSAGE
                                : OFPRAW_OFPT14_BUNDLE_ADD_MESSAGE, ofp_version,
-                               msg->msg->xid, 0);
+                               msg->msg->xid, ntohs(msg->msg->length));
     m = ofpbuf_put_zeros(request, sizeof *m);
 
     m->bundle_id = htonl(msg->bundle_id);
     m->flags = htons(msg->flags);
     ofpbuf_put(request, msg->msg, ntohs(msg->msg->length));
 
+    ofpmsg_update_length(request);
     return request;
 }
 
index 50b40470e018abc994202b4565e2b6364474d323..917ad282e53488983f9714fc4538fe14e9ae0306 100644 (file)
@@ -1040,12 +1040,13 @@ vconn_bundle_add_msg(struct vconn *vconn, struct ofputil_bundle_ctrl_msg *bc,
     struct ofpbuf *request;
     int error;
 
+    ofpmsg_update_length(msg);
+
     bam.bundle_id = bc->bundle_id;
     bam.flags = bc->flags;
     bam.msg = msg->data;
 
     request = ofputil_encode_bundle_add(vconn->version, &bam);
-    ofpmsg_update_length(request);
 
     error = vconn_send_block(vconn, request);
     if (!error) {