[ovs-dev] [PATCH] openflow: Print in_port as string for reserved/special ports.

Ben Pfaff blp at nicira.com
Wed Jan 9 00:26:56 UTC 2013


On Tue, Jan 08, 2013 at 04:08:54PM -0800, Gurucharan Shetty wrote:
>      if (wc->masks.in_port) {
> -        ds_put_format(s, "in_port=%"PRIu16",", f->in_port);
> +        if (f->in_port >= OFPP_FIRST_RESV) {
> +            struct ds reserved_port;
> +            ds_init(&reserved_port);
> +            ofputil_format_port(f->in_port, &reserved_port);
> +            ds_put_format(s, "in_port=%s,", ds_cstr(&reserved_port));
> +            ds_destroy(&reserved_port);
> +        } else {
> +            ds_put_format(s, "in_port=%"PRIu16",", f->in_port);
> +        }

Why not just this:
        ds_put_cstr(s, "in_port=");
        ofputil_format_port(f->in_port, s);
        ds_put_char(s, ',');

Thanks,

Ben.



More information about the dev mailing list