[ovs-dev] [error reporting 5/6] ofproto: Add error code for bad role.

Ethan Jackson ethan at nicira.com
Sat Oct 22 01:12:37 UTC 2011


Looks good.

Ethan

On Thu, Sep 8, 2011 at 12:36, Ben Pfaff <blp at nicira.com> wrote:
> ---
>  include/openflow/nicira-ext.h |    3 +++
>  ofproto/ofproto.c             |    3 +--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
> index fe725be..890e974 100644
> --- a/include/openflow/nicira-ext.h
> +++ b/include/openflow/nicira-ext.h
> @@ -107,6 +107,9 @@ enum nx_bad_request_code {
>      * used instead, when it is appropriate, because that is such a special
>      * case.) */
>     NXBRC_BAD_TABLE_ID = 0x200,
> +
> +    /* NXT_ROLE_REQUEST specified an invalid role. */
> +    NXBRC_BAD_ROLE = 0x201,
>  };
>
>  /* Additional "code" values for OFPET_FLOW_MOD_FAILED. */
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index f501b41..156dc90 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -2531,8 +2531,7 @@ handle_role_request(struct ofconn *ofconn, const struct ofp_header *oh)
>     role = ntohl(nrr->role);
>     if (role != NX_ROLE_OTHER && role != NX_ROLE_MASTER
>         && role != NX_ROLE_SLAVE) {
> -        /* There's no good error code for this. */
> -        return ofp_mkerr(OFPET_BAD_REQUEST, -1);
> +        return ofp_mkerr_nicira(OFPET_BAD_REQUEST, NXBRC_BAD_ROLE);
>     }
>
>     if (ofconn_get_role(ofconn) != role
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list