summaryrefslogtreecommitdiff
path: root/lib/ofp-msgs.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-08-03 15:56:02 -0700
committerBen Pfaff <blp@nicira.com>2012-08-06 09:26:57 -0700
commit79b8c36c58f979296ce2cec1e6d899fa8321bc21 (patch)
tree842e8c12ab68c330d5e10a2480a7984a11d855d6 /lib/ofp-msgs.c
parent1448105187550e12fe806aa4863ffa5dc397afb8 (diff)
downloadopenvswitch-79b8c36c58f979296ce2cec1e6d899fa8321bc21.tar.gz
ofp-msgs: ofpmp_reserve() must add "more" flag when splitting stats.
Commit 982697a4d2 "ofp-msgs: New approach to encoding and decoding OpenFlow headers." introduced a bug in multipart message composition such that, when a multipart message actually requires multiple parts, the OFPSF_REPLY_MORE bit failed to be set on any of the parts, which in turn caused the receiver to see a truncated reply. This commit fixes the problem. This commit also adds a test case that would have detected the problem and fixes a minor bug in that test case (if an error actually occurred, then the test case would hang). Bug #12766. Reported-by: James Schmidt <jschmidt@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/ofp-msgs.c')
-rw-r--r--lib/ofp-msgs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
index 07ee87a3d..00e1a8448 100644
--- a/lib/ofp-msgs.c
+++ b/lib/ofp-msgs.c
@@ -789,6 +789,8 @@ ofpmsg_body(const struct ofp_header *oh)
return (const uint8_t *) oh + ofphdrs_len(&hdrs);
}
+static ovs_be16 *ofpmp_flags__(const struct ofp_header *);
+
/* Initializes 'replies' as a new list of stats messages that reply to
* 'request', which must be a stats request message. Initially the list will
* consist of only a single reply part without any body. The caller should
@@ -832,6 +834,8 @@ ofpmp_reserve(struct list *replies, size_t len)
ofpbuf_put(next, msg->data, hdrs_len);
list_push_back(replies, &next->list_node);
+ *ofpmp_flags__(msg->data) |= htons(OFPSF_REPLY_MORE);
+
return next;
}
}