}
if (NXM_HASMASK(oxm_header)) {
- return OFPERR_OFPBAC_BAD_SET_TYPE;
+ return OFPERR_OFPBAC_BAD_SET_MASK;
}
mf = mf_from_nxm_header(oxm_header);
if (!mf) {
}
\f
static void
-log_bad_action(const struct ofp_action_header *actions, size_t max_actions,
+log_bad_action(const struct ofp_action_header *actions, size_t actions_len,
const struct ofp_action_header *bad_action, enum ofperr error)
{
if (!VLOG_DROP_WARN(&rl)) {
struct ds s;
ds_init(&s);
- ds_put_hex_dump(&s, actions, max_actions * OFP_ACTION_ALIGN, 0, false);
+ ds_put_hex_dump(&s, actions, actions_len, 0, false);
VLOG_WARN("bad action at offset %#"PRIxPTR" (%s):\n%s",
(char *)bad_action - (char *)actions,
ofperr_get_name(error), ds_cstr(&s));
}
if (error) {
- log_bad_action(actions, actions_len * 8, action, error);
+ log_bad_action(actions, actions_len, action, error);
return error;
}
}
/* True if an action sets the value of a field
* in a way that is compatibile with the action set.
+ * The field can be set via either a set or a move action.
* False otherwise. */
static bool
-ofpact_is_set_action(const struct ofpact *a)
+ofpact_is_set_or_move_action(const struct ofpact *a)
{
switch (a->type) {
case OFPACT_SET_FIELD:
case OFPACT_REG_LOAD:
+ case OFPACT_REG_MOVE:
case OFPACT_SET_ETH_DST:
case OFPACT_SET_ETH_SRC:
case OFPACT_SET_IP_DSCP:
case OFPACT_POP_QUEUE:
case OFPACT_PUSH_MPLS:
case OFPACT_PUSH_VLAN:
- case OFPACT_REG_MOVE:
case OFPACT_RESUBMIT:
case OFPACT_SAMPLE:
case OFPACT_STACK_POP:
case OFPACT_PUSH_MPLS:
case OFPACT_PUSH_VLAN:
case OFPACT_REG_LOAD:
+ case OFPACT_REG_MOVE:
case OFPACT_SET_FIELD:
case OFPACT_SET_ETH_DST:
case OFPACT_SET_ETH_SRC:
case OFPACT_NOTE:
case OFPACT_OUTPUT_REG:
case OFPACT_POP_QUEUE:
- case OFPACT_REG_MOVE:
case OFPACT_RESUBMIT:
case OFPACT_SAMPLE:
case OFPACT_STACK_POP:
ofpacts_copy_last(action_list, action_set, OFPACT_PUSH_VLAN);
ofpacts_copy_last(action_list, action_set, OFPACT_DEC_TTL);
ofpacts_copy_last(action_list, action_set, OFPACT_DEC_MPLS_TTL);
- ofpacts_copy_all(action_list, action_set, ofpact_is_set_action);
+ ofpacts_copy_all(action_list, action_set, ofpact_is_set_or_move_action);
ofpacts_copy_last(action_list, action_set, OFPACT_SET_QUEUE);
/* If both OFPACT_GROUP and OFPACT_OUTPUT are present, OpenFlow says that
* all the actions because there's no point in modifying a packet that will
* not be sent anywhere. */
if (!ofpacts_copy_last(action_list, action_set, OFPACT_GROUP) &&
- !ofpacts_copy_last(action_list, action_set, OFPACT_OUTPUT)) {
+ !ofpacts_copy_last(action_list, action_set, OFPACT_OUTPUT) &&
+ !ofpacts_copy_last(action_list, action_set, OFPACT_RESUBMIT)) {
ofpbuf_clear(action_list);
}
}
switch (a->type) {
#define OFPACT(ENUM, STRUCT, MEMBER, NAME) \
case OFPACT_##ENUM: \
- return encode_##ENUM(ofpact_get_##ENUM(a), ofp_version, out);
+ encode_##ENUM(ofpact_get_##ENUM(a), ofp_version, out); \
+ return;
OFPACTS
#undef OFPACT
default: