From: Jarno Rajahalme Date: Fri, 30 Nov 2012 21:45:08 +0000 (-0800) Subject: Don't use error categories as if they were actually errors. X-Git-Tag: sliver-openvswitch-1.9.90-3~10^2~122 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=15549878535c7331c3952e656a2eb9944d0021bb;p=sliver-openvswitch.git Don't use error categories as if they were actually errors. The OFPERR_* naming scheme is confusing, because it mixes categories with specific errors. Categories can't be encoded for sending to controllers, so this is a problem. This commit fixes up the cases where categories were used as errors, replacing them by real errors types. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 9c458a936..b758c7c92 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -718,7 +718,7 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) if (((const struct ofp11_action_push *)a)->ethertype != htons(ETH_TYPE_VLAN_8021Q)) { /* TODO:XXX 802.1AD(QinQ) isn't supported at the moment */ - return OFPERR_OFPET_BAD_ACTION; + return OFPERR_OFPBAC_BAD_ARGUMENT; } ofpact_put_PUSH_VLAN(out); break; @@ -917,7 +917,9 @@ decode_openflow11_instructions(const struct ofp11_instruction insts[], } if (out[type]) { - return OFPERR_OFPIT_BAD_INSTRUCTION; + return OFPERR_OFPBAC_UNSUPPORTED_ORDER; /* No specific code for + * a duplicate instruction + * exist */ } out[type] = inst; } @@ -1157,7 +1159,6 @@ ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len) if (om) { if (a->type == OFPACT_WRITE_METADATA) { VLOG_WARN("duplicate write_metadata instruction specified"); - /* should be OFPERR_OFPET_BAD_ACTION? */ return OFPERR_OFPBAC_UNSUPPORTED_ORDER; } else { VLOG_WARN("write_metadata instruction must be specified after " diff --git a/lib/ofp-errors.h b/lib/ofp-errors.h index e9fedb9e0..5c3df20d9 100644 --- a/lib/ofp-errors.h +++ b/lib/ofp-errors.h @@ -161,6 +161,11 @@ enum ofperr { * the id of any existing monitor. */ OFPERR_NXBRC_FM_BAD_ID, + /* NX1.0+(1,520). The 'event' in an NXST_FLOW_MONITOR reply does not + * specify one of the NXFME_ABBREV, NXFME_ADD, NXFME_DELETE, or + * NXFME_MODIFY. */ + OFPERR_NXBRC_FM_BAD_EVENT, + /* ## ---------------- ## */ /* ## OFPET_BAD_ACTION ## */ /* ## ---------------- ## */ diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 320bfde47..11b6192e0 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3681,7 +3681,7 @@ ofputil_decode_flow_update(struct ofputil_flow_update *update, VLOG_WARN_RL(&bad_ofmsg_rl, "NXST_FLOW_MONITOR reply has bad event %"PRIu16, ntohs(nfuh->event)); - return OFPERR_OFPET_BAD_REQUEST; + return OFPERR_NXBRC_FM_BAD_EVENT; } bad_len: diff --git a/tests/ofp-actions.at b/tests/ofp-actions.at index f30fa06cd..30fcf51ff 100644 --- a/tests/ofp-actions.at +++ b/tests/ofp-actions.at @@ -341,7 +341,7 @@ dnl Check that an empty Apply-Actions instruction gets dropped. 0004 0008 00000000 dnl Duplicate instruction type: -# bad OF1.1 instructions: OFPIT_BAD_INSTRUCTION +# bad OF1.1 instructions: OFPBAC_UNSUPPORTED_ORDER 0004 0008 00000000 0004 0008 00000000 dnl Instructions not multiple of 8 in length. @@ -379,7 +379,7 @@ dnl Write-Metadata too long. 0002 0020 00000000 fedcba9876543210 ffffffffffffffff 0000000000000000 dnl Write-Metadata duplicated. -# bad OF1.1 instructions: OFPIT_BAD_INSTRUCTION +# bad OF1.1 instructions: OFPBAC_UNSUPPORTED_ORDER 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 0002 0018 00000000 fedcba9876543210 ff00ff00ff00ff00 dnl Write-Metadata in wrong position.