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>
return (const uint8_t *) oh + ofphdrs_len(&hdrs);
}
\f
+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
ofpbuf_put(next, msg->data, hdrs_len);
list_push_back(replies, &next->list_node);
+ *ofpmp_flags__(msg->data) |= htons(OFPSF_REPLY_MORE);
+
return next;
}
}
OVS_VSWITCHD_START
# Start a monitor watching the flow table, then make it block.
+trap 'kill `cat ovsdb-server.pid ovs-vswitchd.pid ovs-ofctl.pid`' 0
ovs-ofctl monitor br0 watch: --detach --no-chdir --pidfile >monitor.log 2>&1
AT_CAPTURE_FILE([monitor.log])
ovs-appctl -t ovs-ofctl ofctl/block
}
') > flows.txt
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
+# Check that multipart flow dumps work properly:
+AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
AT_CHECK([ovs-ofctl add-flow br0 in_port=1,cookie=3,actions=drop])
AT_CHECK([ovs-ofctl mod-flows br0 in_port=2,cookie=2,actions=output:2])
AT_CHECK([ovs-ofctl del-flows br0 cookie=1/-1])