On Thu, Aug 29, 2013 at 02:00:51PM -0700, Ben Pfaff wrote:
> From: Neil Zhu <z...@centecnetworks.com>
> 
> This doesn't include a dpif implementation of groups functionality.  In its
> current form, it is untested.  Before this is committed, it needs some
> more comments and an ovs-ofctl manpage update.
> 
> Signed-off-by: Neil Zhu <z...@centecnetworks.com>
> Co-authored-by: Ben Pfaff <b...@nicira.com>
> Signed-off-by: Ben Pfaff <b...@nicira.com>

...

> +ofputil_decode_group_stats_reply(struct ofpbuf *msg,
> +                                 struct ofputil_group_stats *gs)
> +{
> +    struct ofp11_bucket_counter *obc;
> +    struct ofp11_group_stats *ogs11;
> +    enum ofpraw raw;
> +    enum ofperr error;
> +    size_t base_len;
> +    size_t length;
> +    size_t i;
> +
> +    if (!msg->size) {
> +        return EOF;
> +    }
> +
> +    error = (msg->l2
> +             ? ofpraw_decode(&raw, msg->l2)
> +             : ofpraw_pull(&raw, msg));
> +    if (error) {
> +        return error;
> +    }

It seems to me that the msg->size check should appear after
the ofpraw_decode()/ofpraw_pull() call in order to allow for
a stats reply with an empty array of stats.

This would also be consistent with the code present in
ofputil_decode_queue_stats();


With the code above I see:
# ovs-ofctl -O OpenFlow11 dump-group-stats br0
2013-08-30T06:58:51Z|00003|ofp_util|WARN|OFPST_GROUP reply reply has 0 leftover 
bytes at end
OFPST_GROUP reply (OF1.1) (xid=0x2): ***parse error***

With my suggested change I see:
# ovs-ofctl -O OpenFlow11 dump-group-stats br0
OFPST_GROUP reply (OF1.1) (xid=0x2):
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to