2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-02 15:25:22 +00:00

ofp-errors: Use OFPERR_OFPBRC_BAD_PORT

* In the case of OpenFlow 1.2+ OFPERR_OFPBRC_BAD_PORT is defined
  in the specification and seems to be the most appropriate error
  to use when an invalid port is encountered in a Packet Out request.

* In the case of OpenFlow 1.0 and 1.1 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,514).
  This was formerly known as OFPERR_NXBRC_BAD_IN_PORT but
  has been rolled into OFPERR_NXBRC_BAD_IN_PORT to allow the
  latter to be used without concern for the prevailing Open Flow version.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Simon Horman
2012-09-05 11:50:37 +09:00
committed by Ben Pfaff
parent 55c2b94431
commit 2e1bfcb631
4 changed files with 7 additions and 12 deletions

View File

@@ -118,7 +118,10 @@ enum ofperr {
/* OF1.2+(1,10). Denied because controller is slave. */ /* OF1.2+(1,10). Denied because controller is slave. */
OFPERR_OFPBRC_IS_SLAVE, OFPERR_OFPBRC_IS_SLAVE,
/* OF1.2+(1,11). Invalid port. */ /* NX1.0(1,514), NX1.1(1,514), OF1.2+(1,11). Invalid port.
* [ A non-standard error (1,514), formerly
* OFPERR_NXBRC_BAD_IN_PORT is used for OpenFlow 1.0 and 1.1 as there
* seems to be no appropriste error code defined the specifications. ] */
OFPERR_OFPBRC_BAD_PORT, OFPERR_OFPBRC_BAD_PORT,
/* OF1.2+(1,12). Invalid packet in packet-out. */ /* OF1.2+(1,12). Invalid packet in packet-out. */
@@ -134,9 +137,6 @@ enum ofperr {
/* NX1.0+(1,512). A request specified a nonexistent table ID. */ /* NX1.0+(1,512). A request specified a nonexistent table ID. */
OFPERR_NXBRC_BAD_TABLE_ID, OFPERR_NXBRC_BAD_TABLE_ID,
/* NX1.0+(1,514). The in_port in an ofp_packet_out request is invalid. */
OFPERR_NXBRC_BAD_IN_PORT,
/* NX1.0+(1,515). Must-be-zero field had nonzero value. */ /* NX1.0+(1,515). Must-be-zero field had nonzero value. */
OFPERR_NXBRC_MUST_BE_ZERO, OFPERR_NXBRC_MUST_BE_ZERO,

View File

@@ -2279,7 +2279,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
const struct ofp_header *oh, const struct ofp_header *oh,
struct ofpbuf *ofpacts) struct ofpbuf *ofpacts)
{ {
enum ofperr bad_in_port_err;
enum ofpraw raw; enum ofpraw raw;
struct ofpbuf b; struct ofpbuf b;
@@ -2301,8 +2300,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
if (error) { if (error) {
return error; return error;
} }
bad_in_port_err = OFPERR_OFPBMC_BAD_VALUE;
} else if (raw == OFPRAW_OFPT10_PACKET_OUT) { } else if (raw == OFPRAW_OFPT10_PACKET_OUT) {
enum ofperr error; enum ofperr error;
const struct ofp_packet_out *opo = ofpbuf_pull(&b, sizeof *opo); const struct ofp_packet_out *opo = ofpbuf_pull(&b, sizeof *opo);
@@ -2314,8 +2311,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
if (error) { if (error) {
return error; return error;
} }
bad_in_port_err = OFPERR_NXBRC_BAD_IN_PORT;
} else { } else {
NOT_REACHED(); NOT_REACHED();
} }
@@ -2324,7 +2319,7 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po,
&& po->in_port != OFPP_NONE && po->in_port != OFPP_CONTROLLER) { && po->in_port != OFPP_NONE && po->in_port != OFPP_CONTROLLER) {
VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out has bad input port %#"PRIx16, VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out has bad input port %#"PRIx16,
po->in_port); po->in_port);
return bad_in_port_err; return OFPERR_OFPBRC_BAD_PORT;
} }
po->ofpacts = ofpacts->data; po->ofpacts = ofpacts->data;

View File

@@ -948,7 +948,7 @@ struct ofproto_class {
* *
* flow->in_port comes from the OpenFlow OFPT_PACKET_OUT message. The * flow->in_port comes from the OpenFlow OFPT_PACKET_OUT message. The
* implementation should reject invalid flow->in_port values by returning * implementation should reject invalid flow->in_port values by returning
* OFPERR_NXBRC_BAD_IN_PORT. (If the implementation called * OFPERR_OFPBRC_BAD_PORT. (If the implementation called
* ofproto_init_max_ports(), then the client will reject these ports * ofproto_init_max_ports(), then the client will reject these ports
* itself.) For consistency, the implementation should consider valid for * itself.) For consistency, the implementation should consider valid for
* flow->in_port any value that could possibly be seen in a packet that it * flow->in_port any value that could possibly be seen in a packet that it

View File

@@ -2130,7 +2130,7 @@ handle_packet_out(struct ofconn *ofconn, const struct ofp_header *oh)
goto exit_free_ofpacts; goto exit_free_ofpacts;
} }
if (po.in_port >= p->max_ports && po.in_port < OFPP_MAX) { if (po.in_port >= p->max_ports && po.in_port < OFPP_MAX) {
error = OFPERR_NXBRC_BAD_IN_PORT; error = OFPERR_OFPBRC_BAD_PORT;
goto exit_free_ofpacts; goto exit_free_ofpacts;
} }