diff options
author | Ben Pfaff <blp@nicira.com> | 2011-07-21 14:44:54 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-07-27 15:00:34 -0700 |
commit | eaa6eb2afd76819de5df0ae9ed753627504ed7e4 (patch) | |
tree | 47e5fa367e6224739c2ae91408e1ccb8bd1cf7ae /utilities | |
parent | c4ea79bf9c68a4d040a499d142e121f01b314242 (diff) |
ovs-ofctl: Fix dump-ports and queue-stats commands.
These ovs-ofctl commands have been sending malformed stats requests since
commit 63f2140a553 "openflow: Make stats replies more like other OpenFlow
messages." This commit fixes the problem and adds basic unit tests that
should prevent similar regressions.
Reported-by: Hao Zheng <hzheng@nicira.com>
Diffstat (limited to 'utilities')
-rw-r--r-- | utilities/ovs-ofctl.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index e948c662..fef7fdac 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -272,13 +272,14 @@ open_vconn(const char *name, struct vconn **vconnp) } static void * -alloc_stats_request(size_t body_len, uint16_t type, struct ofpbuf **bufferp) +alloc_stats_request(size_t rq_len, uint16_t type, struct ofpbuf **bufferp) { struct ofp_stats_msg *rq; - rq = make_openflow(sizeof *rq + body_len, OFPT_STATS_REQUEST, bufferp); + + rq = make_openflow(rq_len, OFPT_STATS_REQUEST, bufferp); rq->type = htons(type); rq->flags = htons(0); - return rq + 1; + return rq; } static void @@ -344,7 +345,7 @@ static void dump_trivial_stats_transaction(const char *vconn_name, uint8_t stats_type) { struct ofpbuf *request; - alloc_stats_request(0, stats_type, &request); + alloc_stats_request(sizeof(struct ofp_stats_msg), stats_type, &request); dump_stats_transaction(vconn_name, request); } |