From: Ben Pfaff Date: Thu, 8 Sep 2011 18:19:37 +0000 (-0700) Subject: ofproto: Add error code for bad role. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68f36edfe8928be1f80c960abb63474b2ad9f920;p=openvswitch ofproto: Add error code for bad role. --- diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h index 1441ee58..84060d79 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 869b16cd..8a2abdc6 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2711,8 +2711,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