ofproto: Add error code for bad role.
authorBen Pfaff <blp@nicira.com>
Thu, 8 Sep 2011 18:19:37 +0000 (11:19 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 2 Nov 2011 15:45:34 +0000 (08:45 -0700)
include/openflow/nicira-ext.h
ofproto/ofproto.c

index 1441ee5..84060d7 100644 (file)
@@ -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. */
index 869b16c..8a2abdc 100644 (file)
@@ -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