OFPERR_OFPBAC_BAD_ARGUMENT is not as specific as the errors provided by
OpenFlow 1.2 and later.
Some of these errors needed Nicira extension numbers for use with OpenFlow
1.0 and 1.1, so this commit also adds those.
Some of these errors had poor explanations likely to confuse users, so this
commits improves them.
Some of the errors had the wrong names, so this commit fixes them.
Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jean Tourrilhes <jt@hpl.hp.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
{
if (!sf->field) {
VLOG_WARN_RL(&rl, "unknown %s field", type);
{
if (!sf->field) {
VLOG_WARN_RL(&rl, "unknown %s field", type);
+ return OFPERR_OFPBAC_BAD_SET_TYPE;
} else if (!sf->n_bits) {
VLOG_WARN_RL(&rl, "zero bit %s field %s", type, sf->field->name);
} else if (!sf->n_bits) {
VLOG_WARN_RL(&rl, "zero bit %s field %s", type, sf->field->name);
+ return OFPERR_OFPBAC_BAD_SET_LEN;
} else if (sf->ofs >= sf->field->n_bits) {
VLOG_WARN_RL(&rl, "bit offset %d exceeds %d-bit width of %s field %s",
sf->ofs, sf->field->n_bits, type, sf->field->name);
} else if (sf->ofs >= sf->field->n_bits) {
VLOG_WARN_RL(&rl, "bit offset %d exceeds %d-bit width of %s field %s",
sf->ofs, sf->field->n_bits, type, sf->field->name);
+ return OFPERR_OFPBAC_BAD_SET_LEN;
} else if (sf->ofs + sf->n_bits > sf->field->n_bits) {
VLOG_WARN_RL(&rl, "bit offset %d and width %d exceeds %d-bit width "
"of %s field %s", sf->ofs, sf->n_bits,
sf->field->n_bits, type, sf->field->name);
} else if (sf->ofs + sf->n_bits > sf->field->n_bits) {
VLOG_WARN_RL(&rl, "bit offset %d and width %d exceeds %d-bit width "
"of %s field %s", sf->ofs, sf->n_bits,
sf->field->n_bits, type, sf->field->name);
+ return OFPERR_OFPBAC_BAD_SET_LEN;
} else if (flow && !mf_are_prereqs_ok(sf->field, flow)) {
VLOG_WARN_RL(&rl, "%s field %s lacks correct prerequisites",
type, sf->field->name);
} else if (flow && !mf_are_prereqs_ok(sf->field, flow)) {
VLOG_WARN_RL(&rl, "%s field %s lacks correct prerequisites",
type, sf->field->name);
+ return OFPERR_OFPBAC_MATCH_INCONSISTENT;
-
- return OFPERR_OFPBAC_BAD_ARGUMENT;
}
/* Checks whether 'sf' is valid for reading a subfield out of 'flow'. Returns
}
/* Checks whether 'sf' is valid for reading a subfield out of 'flow'. Returns
if (!error && !sf->field->writable) {
VLOG_WARN_RL(&rl, "destination field %s is not writable",
sf->field->name);
if (!error && !sf->field->writable) {
VLOG_WARN_RL(&rl, "destination field %s is not writable",
sf->field->name);
- return OFPERR_OFPBAC_BAD_ARGUMENT;
+ return OFPERR_OFPBAC_BAD_SET_ARGUMENT;
/* ofp12_action_set_field is padded to 64 bits by zero */
if (oasf_len != ROUND_UP(sizeof(*oasf) + oxm_length, 8)) {
/* ofp12_action_set_field is padded to 64 bits by zero */
if (oasf_len != ROUND_UP(sizeof(*oasf) + oxm_length, 8)) {
- return OFPERR_OFPBAC_BAD_ARGUMENT;
+ return OFPERR_OFPBAC_BAD_SET_LEN;
}
if (!is_all_zeros((const uint8_t *)(oasf) + sizeof *oasf + oxm_length,
oasf_len - oxm_length - sizeof *oasf)) {
}
if (!is_all_zeros((const uint8_t *)(oasf) + sizeof *oasf + oxm_length,
oasf_len - oxm_length - sizeof *oasf)) {
- return OFPERR_OFPBAC_BAD_ARGUMENT;
+ return OFPERR_OFPBAC_BAD_SET_ARGUMENT;
}
if (NXM_HASMASK(oxm_header)) {
}
if (NXM_HASMASK(oxm_header)) {
- return OFPERR_OFPBAC_BAD_ARGUMENT;
+ return OFPERR_OFPBAC_BAD_SET_TYPE;
}
mf = mf_from_nxm_header(oxm_header);
if (!mf) {
}
mf = mf_from_nxm_header(oxm_header);
if (!mf) {
- return OFPERR_OFPBAC_BAD_ARGUMENT;
+ return OFPERR_OFPBAC_BAD_SET_TYPE;
}
load = ofpact_put_REG_LOAD(ofpacts);
ofpact_set_field_init(load, mf, oasf + 1);
}
load = ofpact_put_REG_LOAD(ofpacts);
ofpact_set_field_init(load, mf, oasf + 1);
/* OF1.1+(2,9). Invalid group id in forward action. */
OFPERR_OFPBAC_BAD_OUT_GROUP,
/* OF1.1+(2,9). Invalid group id in forward action. */
OFPERR_OFPBAC_BAD_OUT_GROUP,
- /* OF1.1+(2,10). Action can't apply for this match. */
+ /* NX1.0(1,522), OF1.1+(2,10). Action can't apply for this match or a
+ * prerequisite for use of this field is unmet. */
OFPERR_OFPBAC_MATCH_INCONSISTENT,
/* OF1.1+(2,11). Action order is unsupported for the action list in an
OFPERR_OFPBAC_MATCH_INCONSISTENT,
/* OF1.1+(2,11). Action order is unsupported for the action list in an
/* OF1.1+(2,12). Actions uses an unsupported tag/encap. */
OFPERR_OFPBAC_BAD_TAG,
/* OF1.1+(2,12). Actions uses an unsupported tag/encap. */
OFPERR_OFPBAC_BAD_TAG,
- /* OF1.2+(2,13). Unsupported type in SET_FIELD action. */
- OFPERR_OFPBAC_SET_TYPE,
+ /* NX1.0-1.1(1,523), OF1.2+(2,13). Action uses unknown or unsupported OXM
+ * or NXM field. */
+ OFPERR_OFPBAC_BAD_SET_TYPE,
- /* OF1.2+(2,14). Length problem in SET_FIELD action. */
- OFPERR_OFPBAC_SET_LEN,
+ /* NX1.0-1.1(1,524), OF1.2+(2,14). Action references past the end of an
+ * OXM or NXM field, or uses a length of zero. */
+ OFPERR_OFPBAC_BAD_SET_LEN,
- /* OF1.2+(2,15). Bad argument in SET_FIELD action. */
- OFPERR_OFPBAC_ARGUMENT,
+ /* NX1.0-1.1(1,525), OF1.2+(2,15). Action sets a field to an invalid or
+ * unsupported value, or modifies a read-only field. */
+ OFPERR_OFPBAC_BAD_SET_ARGUMENT,
/* NX1.0-1.1(2,256), NX1.2+(11). Must-be-zero action argument had nonzero
* value. */
/* NX1.0-1.1(2,256), NX1.2+(11). Must-be-zero action argument had nonzero
* value. */
[1], [], [stderr])
AT_CHECK([sed -e 's/.*|meta_flow|WARN|//' < stderr], [0],
[[destination field ip_dst lacks correct prerequisites
[1], [], [stderr])
AT_CHECK([sed -e 's/.*|meta_flow|WARN|//' < stderr], [0],
[[destination field ip_dst lacks correct prerequisites
-ovs-ofctl: actions are invalid with specified match (OFPBAC_BAD_ARGUMENT)
+ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
]], [[]])
AT_CHECK([[ovs-ofctl parse-flow 'actions=learn(load:NXM_OF_IP_DST[]->NXM_NX_REG1[])']],
[1], [], [stderr])
AT_CHECK([sed -e 's/.*|meta_flow|WARN|//' < stderr], [0],
[[source field ip_dst lacks correct prerequisites
]], [[]])
AT_CHECK([[ovs-ofctl parse-flow 'actions=learn(load:NXM_OF_IP_DST[]->NXM_NX_REG1[])']],
[1], [], [stderr])
AT_CHECK([sed -e 's/.*|meta_flow|WARN|//' < stderr], [0],
[[source field ip_dst lacks correct prerequisites
-ovs-ofctl: actions are invalid with specified match (OFPBAC_BAD_ARGUMENT)
+ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)