* 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 <ho...@verge.net.au> --- lib/ofp-errors.h | 8 ++++---- lib/ofp-util.c | 7 +------ ofproto/ofproto-dpif.c | 2 +- ofproto/ofproto-provider.h | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h index 69ada40..ca1a548 100644 --- a/lib/ofp-errors.h +++ b/lib/ofp-errors.h @@ -105,7 +105,10 @@ enum ofperr { /* OF1.2+(1,10). Denied because controller is slave. */ OFPERR_OFPBRC_IS_SLAVE, - /* OF1.2+(1,11). Invalid port. */ + /* OF1.0(1,514), OF1.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, /* OF1.2+(1,12). Invalid packet in packet-out. */ @@ -121,9 +124,6 @@ enum ofperr { /* NX1.0+(1,512). A request specified a nonexistent 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. */ OFPERR_NXBRC_MUST_BE_ZERO, diff --git a/lib/ofp-util.c b/lib/ofp-util.c index a9145b4..f44c06e 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -2293,7 +2293,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po, const struct ofp_header *oh, struct ofpbuf *ofpacts) { - enum ofperr bad_in_port_err; enum ofpraw raw; struct ofpbuf b; @@ -2315,8 +2314,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po, if (error) { return error; } - - bad_in_port_err = OFPERR_OFPBMC_BAD_VALUE; } else if (raw == OFPRAW_OFPT10_PACKET_OUT) { enum ofperr error; const struct ofp_packet_out *opo = ofpbuf_pull(&b, sizeof *opo); @@ -2328,8 +2325,6 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po, if (error) { return error; } - - bad_in_port_err = OFPERR_NXBRC_BAD_IN_PORT; } else { NOT_REACHED(); } @@ -2338,7 +2333,7 @@ ofputil_decode_packet_out(struct ofputil_packet_out *po, && po->in_port != OFPP_NONE && po->in_port != OFPP_CONTROLLER) { VLOG_WARN_RL(&bad_ofmsg_rl, "packet-out has bad input port %#"PRIx16, po->in_port); - return bad_in_port_err; + return OFPERR_OFPBRC_BAD_PORT; } po->ofpacts = ofpacts->data; diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 78cb186..1ac19ba 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -6444,7 +6444,7 @@ packet_out(struct ofproto *ofproto_, struct ofpbuf *packet, enum ofperr error; if (flow->in_port >= ofproto->max_ports && flow->in_port < OFPP_MAX) { - return OFPERR_NXBRC_BAD_IN_PORT; + return OFPERR_OFPBRC_BAD_PORT; } error = ofpacts_check(ofpacts, ofpacts_len, flow, ofproto->max_ports); diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 15dc347..87ca29c 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -946,7 +946,7 @@ struct ofproto_class { * * flow->in_port comes from the OpenFlow OFPT_PACKET_OUT message. The * implementation should reject invalid flow->in_port values by returning - * OFPERR_NXBRC_BAD_IN_PORT. For consistency, the implementation should + * OFPERR_OFPBRC_BAD_PORT. For consistency, the implementation should * consider valid for flow->in_port any value that could possibly be seen * in a packet that it passes to connmgr_send_packet_in(). Ideally, even * an implementation that never generates packet-ins (e.g. due to hardware -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev