Looks good.

Thanks,
Pravin.

On Wed, Jun 27, 2012 at 10:05 AM, Ben Pfaff <b...@nicira.com> wrote:
> dump_stats_transaction() ignored errors and other non-stats replies to
> its request and would continue to wait forever.  This fixes the problem.
>
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
> v1 was here: http://openvswitch.org/pipermail/dev/2012-June/017779.html
> v2: Fix dumb assumption that all replies are queue stats (!).
>
>  utilities/ovs-ofctl.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
> index 7413455..a2dfabf 100644
> --- a/utilities/ovs-ofctl.c
> +++ b/utilities/ovs-ofctl.c
> @@ -380,6 +380,7 @@ static void
>  dump_stats_transaction(const char *vconn_name, struct ofpbuf *request)
>  {
>     ovs_be32 send_xid = ((struct ofp_header *) request->data)->xid;
> +    ovs_be16 stats_type = ((struct ofp_stats_msg *) request->data)->type;
>     struct vconn *vconn;
>     bool done = false;
>
> @@ -392,12 +393,21 @@ dump_stats_transaction(const char *vconn_name, struct 
> ofpbuf *request)
>         run(vconn_recv_block(vconn, &reply), "OpenFlow packet receive 
> failed");
>         recv_xid = ((struct ofp_header *) reply->data)->xid;
>         if (send_xid == recv_xid) {
> -            struct ofp_stats_msg *osm;
> +            const struct ofp_stats_msg *osm = reply->data;
> +            const struct ofp_header *oh = reply->data;
>
>             ofp_print(stdout, reply->data, reply->size, verbosity + 1);
>
> -            osm = ofpbuf_at(reply, 0, sizeof *osm);
> -            done = !osm || !(ntohs(osm->flags) & OFPSF_REPLY_MORE);
> +            if (oh->type == OFPT_ERROR) {
> +                done = true;
> +            } else if (oh->type == OFPT10_STATS_REPLY
> +                       && osm->type == stats_type) {
> +                done = !(ntohs(osm->flags) & OFPSF_REPLY_MORE);
> +            } else {
> +                ovs_fatal(0, "received bad reply: %s",
> +                          ofp_to_string(reply->data, reply->size,
> +                                        verbosity + 1));
> +            }
>         } else {
>             VLOG_DBG("received reply with xid %08"PRIx32" "
>                      "!= expected %08"PRIx32, recv_xid, send_xid);
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to