X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-util.c;h=11b0f159ec805a053d8208ed79019f0aefa39576;hb=fbac791aea04553de6efa02e78a9724d85cccb88;hp=923df057a1672f29f07153e1ad50e27a6602facb;hpb=eadef313296eac5c2fa99bc1d7a32e514a7989bf;p=openvswitch diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 923df057..11b0f159 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -101,18 +101,20 @@ 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 == 6); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7); /* Initialize most of rule->wc. */ flow_wildcards_init_catchall(wc); wc->wildcards = (OVS_FORCE flow_wildcards_t) ofpfw & WC_INVARIANTS; /* Wildcard fields that aren't defined by ofp_match or tun_id. */ - wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_NW_TTL + wc->wildcards |= (FWW_ARP_SHA | FWW_ARP_THA | FWW_NW_ECN | FWW_NW_TTL | FWW_ND_TARGET | FWW_IPV6_LABEL); - if (!(ofpfw & OFPFW_NW_TOS)) { - wc->nw_tos_mask |= IP_DSCP_MASK; + if (ofpfw & OFPFW_NW_TOS) { + /* OpenFlow 1.0 defines a TOS wildcard, but it's much later in + * the enum than we can use. */ + wc->wildcards |= FWW_NW_DSCP; } wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT); @@ -194,7 +196,7 @@ ofputil_cls_rule_to_match(const struct cls_rule *rule, struct ofp_match *match) ofpfw = (OVS_FORCE uint32_t) (wc->wildcards & WC_INVARIANTS); ofpfw |= ofputil_netmask_to_wcbits(wc->nw_src_mask) << OFPFW_NW_SRC_SHIFT; ofpfw |= ofputil_netmask_to_wcbits(wc->nw_dst_mask) << OFPFW_NW_DST_SHIFT; - if (!(wc->nw_tos_mask & IP_DSCP_MASK)) { + if (wc->wildcards & FWW_NW_DSCP) { ofpfw |= OFPFW_NW_TOS; } @@ -859,7 +861,7 @@ ofputil_min_flow_format(const struct cls_rule *rule) { const struct flow_wildcards *wc = &rule->wc; - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 6); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7); /* Only NXM supports separately wildcards the Ethernet multicast bit. */ if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) { @@ -898,7 +900,7 @@ ofputil_min_flow_format(const struct cls_rule *rule) } /* Only NXM supports matching IP ECN bits. */ - if (wc->nw_tos_mask & IP_ECN_MASK) { + if (!(wc->wildcards & FWW_NW_ECN)) { return NXFF_NXM; } @@ -2209,7 +2211,8 @@ validate_actions(const union ofp_action *actions, size_t n_actions, case OFPUTIL_OFPAT_ENQUEUE: port = ntohs(((const struct ofp_action_enqueue *) a)->port); - if (port >= max_ports && port != OFPP_IN_PORT) { + if (port >= max_ports && port != OFPP_IN_PORT + && port != OFPP_LOCAL) { error = ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_OUT_PORT); } break; @@ -2524,7 +2527,7 @@ ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format) MAY_IPVx = 1 << 3, /* tos, frag, ttl */ MAY_ARP_SHA = 1 << 4, /* arp_sha */ MAY_ARP_THA = 1 << 5, /* arp_tha */ - MAY_IPV6_ADDR = 1 << 6, /* ipv6_src, ipv6_dst */ + MAY_IPV6 = 1 << 6, /* ipv6_src, ipv6_dst, ipv6_label */ MAY_ND_TARGET = 1 << 7 /* nd_target */ } may_match; @@ -2540,7 +2543,7 @@ ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format) } } else if (rule->flow.dl_type == htons(ETH_TYPE_IPV6) && flow_format == NXFF_NXM) { - may_match = MAY_NW_PROTO | MAY_IPVx | MAY_IPV6_ADDR; + may_match = MAY_NW_PROTO | MAY_IPVx | MAY_IPV6; if (rule->flow.nw_proto == IPPROTO_TCP || rule->flow.nw_proto == IPPROTO_UDP) { may_match |= MAY_TP_ADDR; @@ -2573,8 +2576,8 @@ ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format) wc.wildcards |= FWW_NW_PROTO; } if (!(may_match & MAY_IPVx)) { - wc.nw_tos_mask = 0; - wc.nw_frag_mask = 0; + wc.wildcards |= FWW_NW_DSCP; + wc.wildcards |= FWW_NW_ECN; wc.wildcards |= FWW_NW_TTL; } if (!(may_match & MAY_ARP_SHA)) { @@ -2583,7 +2586,7 @@ ofputil_normalize_rule(struct cls_rule *rule, enum nx_flow_format flow_format) if (!(may_match & MAY_ARP_THA)) { wc.wildcards |= FWW_ARP_THA; } - if (!(may_match & MAY_IPV6_ADDR)) { + if (!(may_match & MAY_IPV6)) { wc.ipv6_src_mask = wc.ipv6_dst_mask = in6addr_any; wc.wildcards |= FWW_IPV6_LABEL; }