From 68f36edfe8928be1f80c960abb63474b2ad9f920 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 8 Sep 2011 11:19:37 -0700 Subject: [PATCH] ofproto: Add error code for bad role. --- 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 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 -- 2.30.2