X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-util.c;h=b0e74055dcdbc4f2e8b5f1b43d3afd0b59678bff;hb=4ad2802695284467b559ca6790cd890359ffa159;hp=71c28b2c5c7964e94bc9ae9b5cb5a3eb82eb5c08;hpb=81d1ea941425aea5eff1d9582ad12c9b3b528fe8;p=sliver-openvswitch.git diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 71c28b2c5..b0e74055d 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -108,6 +108,8 @@ static const flow_wildcards_t WC_INVARIANTS = 0 void ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc) { + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1); + /* Initialize most of rule->wc. */ flow_wildcards_init_catchall(wc); wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS; @@ -800,6 +802,8 @@ ofputil_min_flow_format(const struct cls_rule *rule) { const struct flow_wildcards *wc = &rule->wc; + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1); + /* Only NXM supports separately wildcards the Ethernet multicast bit. */ if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) { return NXFF_NXM; @@ -1975,6 +1979,22 @@ check_resubmit_table(const struct nx_action_resubmit *nar) return 0; } +static int +check_output_reg(const struct nx_action_output_reg *naor, + const struct flow *flow) +{ + size_t i; + + for (i = 0; i < sizeof naor->zero; i++) { + if (naor->zero[i]) { + return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_ARGUMENT); + } + } + + return nxm_src_check(naor->src, nxm_decode_ofs(naor->ofs_nbits), + nxm_decode_n_bits(naor->ofs_nbits), flow); +} + int validate_actions(const union ofp_action *actions, size_t n_actions, const struct flow *flow, int max_ports) @@ -2053,6 +2073,11 @@ validate_actions(const union ofp_action *actions, size_t n_actions, max_ports, flow); break; + case OFPUTIL_NXAST_OUTPUT_REG: + error = check_output_reg((const struct nx_action_output_reg *) a, + flow); + break; + case OFPUTIL_NXAST_RESUBMIT_TABLE: error = check_resubmit_table( (const struct nx_action_resubmit *) a); @@ -2166,6 +2191,7 @@ ofputil_decode_nxast_action(const union ofp_action *a) NXAST_ACTION(NXAST_BUNDLE, struct nx_action_bundle, true); NXAST_ACTION(NXAST_BUNDLE_LOAD, struct nx_action_bundle, true); NXAST_ACTION(NXAST_RESUBMIT_TABLE, struct nx_action_resubmit, false); + NXAST_ACTION(NXAST_OUTPUT_REG, struct nx_action_output_reg, false); #undef NXAST_ACTION case NXAST_SNAT__OBSOLETE: