This function finds the mf destination field for any ofpact, returning
NULL if not applicable. It will be used by the next patch to properly
reject OpenFlow flows with conntrack actions when conntrack is
unsupported by the datapath.
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
-static const struct mf_field *
-ofpact_get_mf_field(enum ofpact_type type, const void *ofpact)
+/* Returns the destination field that 'ofpact' would write to, or NULL
+ * if the action would not write to an mf_field. */
+const struct mf_field *
+ofpact_get_mf_dst(const struct ofpact *ofpact)
- if (type == OFPACT_SET_FIELD) {
- const struct ofpact_set_field *orl = ofpact;
+ if (ofpact->type == OFPACT_SET_FIELD) {
+ const struct ofpact_set_field *orl;
+ orl = CONTAINER_OF(ofpact, struct ofpact_set_field, ofpact);
- } else if (type == OFPACT_REG_MOVE) {
- const struct ofpact_reg_move *orm = ofpact;
+ } else if (ofpact->type == OFPACT_REG_MOVE) {
+ const struct ofpact_reg_move *orm;
+ orm = CONTAINER_OF(ofpact, struct ofpact_reg_move, ofpact);
static enum ofperr
ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action)
{
static enum ofperr
ofpacts_verify_nested(const struct ofpact *a, enum ofpact_type outer_action)
{
- const struct mf_field *field = ofpact_get_mf_field(a->type, a);
+ const struct mf_field *field = ofpact_get_mf_dst(a);
if (field && field_requires_ct(field->id) && outer_action != OFPACT_CT) {
VLOG_WARN("cannot set CT fields outside of ct action");
if (field && field_requires_ct(field->id) && outer_action != OFPACT_CT) {
VLOG_WARN("cannot set CT fields outside of ct action");
uint32_t group_id);
bool ofpacts_equal(const struct ofpact a[], size_t a_len,
const struct ofpact b[], size_t b_len);
uint32_t group_id);
bool ofpacts_equal(const struct ofpact a[], size_t a_len,
const struct ofpact b[], size_t b_len);
+const struct mf_field *ofpact_get_mf_dst(const struct ofpact *ofpact);
uint32_t ofpacts_get_meter(const struct ofpact[], size_t ofpacts_len);
/* Formatting and parsing ofpacts. */
uint32_t ofpacts_get_meter(const struct ofpact[], size_t ofpacts_len);
/* Formatting and parsing ofpacts. */