From c22c56bd746352f5c70a0d99bb3f548d03cfd105 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 5 Sep 2012 11:50:38 +0900 Subject: [PATCH] ofp-errors: Use OFPERR_OFPBRC_BAD_TABLE_ID * In the case of OpenFlow 1.1+ OFPERR_OFPBRC_BAD_TABLE_ID is defined in the specification and seems to be the most appropriate error to use when an unknown table id is encountered. * In the case of OpenFlow 1.0 no appropriate error message seems to exist. Perhaps because an invalid port is not possible? I'm unsure. In any case, make use of a non-standard error code (1,512). This was formerly known as OFPERR_NXBRC_BAD_TABLE_ID but has been rolled into OFPERR_OFPBRC_BAD_TABLE_ID to allow the latter to be used without concern for the prevailing Open Flow version. Signed-off-by: Simon Horman Signed-off-by: Ben Pfaff --- lib/ofp-errors.h | 8 ++++---- ofproto/ofproto.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h index 9a5dbcb0..a883e201 100644 --- a/lib/ofp-errors.h +++ b/lib/ofp-errors.h @@ -112,7 +112,10 @@ enum ofperr { /* OF1.0+(1,8). Specified buffer does not exist. */ OFPERR_OFPBRC_BUFFER_UNKNOWN, - /* OF1.1+(1,9). Specified table-id invalid or does not exist. */ + /* NX1.0(1,512), OF1.1+(1,9). Specified table-id invalid or does not exist. + * [ A non-standard error (1,512), formerly OFPERR_NXBRC_BAD_TABLE_ID, + * is used for OpenFlow 1.0 as there seems to be no appropriste error + * code defined the specification. ] */ OFPERR_OFPBRC_BAD_TABLE_ID, /* OF1.2+(1,10). Denied because controller is slave. */ @@ -134,9 +137,6 @@ enum ofperr { * nxm_hasmask or nxm_length or both, is invalid or not implemented. */ OFPERR_NXBRC_NXM_BAD_TYPE, - /* NX1.0+(1,512). A request specified a nonexistent table ID. */ - OFPERR_NXBRC_BAD_TABLE_ID, - /* NX1.0+(1,515). Must-be-zero field had nonzero value. */ OFPERR_NXBRC_MUST_BE_ZERO, diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 3c4184f3..9b235e94 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2363,7 +2363,7 @@ check_table_id(const struct ofproto *ofproto, uint8_t table_id) { return (table_id == 0xff || table_id < ofproto->n_tables ? 0 - : OFPERR_NXBRC_BAD_TABLE_ID); + : OFPERR_OFPBRC_BAD_TABLE_ID); } @@ -2914,7 +2914,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn, } else if (fm->table_id < ofproto->n_tables) { table = &ofproto->tables[fm->table_id]; } else { - return OFPERR_NXFMFC_BAD_TABLE_ID; + return OFPERR_OFPBRC_BAD_TABLE_ID; } if (table->flags & OFTABLE_READONLY) { -- 2.30.2