X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-parse.c;h=490c9dff37a8294d1fba96d207ef92024e4d3e3f;hb=7fa710e43fdf2dbf7fe41877cf73e04ccc4a7166;hp=a9bc0c2d7a276578a9aacc1ae62c702c5ec19123;hpb=8050b31d635005a11e5f4ef5517af8672af7cf55;p=openvswitch diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index a9bc0c2d..490c9dff 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -277,6 +277,43 @@ str_to_action(char *str, struct ofpbuf *b) nah = put_action(b, sizeof *nah, OFPAT_VENDOR); nah->vendor = htonl(NX_VENDOR_ID); nah->subtype = htons(NXAST_POP_QUEUE); + } else if (!strcasecmp(act, "note")) { + size_t start_ofs = b->size; + struct nx_action_note *nan; + int remainder; + size_t len; + + nan = put_action(b, sizeof *nan, OFPAT_VENDOR); + nan->vendor = htonl(NX_VENDOR_ID); + nan->subtype = htons(NXAST_NOTE); + + b->size -= sizeof nan->note; + while (arg && *arg != '\0') { + uint8_t byte; + bool ok; + + if (*arg == '.') { + arg++; + } + if (*arg == '\0') { + break; + } + + byte = hexits_value(arg, 2, &ok); + if (!ok) { + ovs_fatal(0, "bad hex digit in `note' argument"); + } + ofpbuf_put(b, &byte, 1); + + arg += 2; + } + + len = b->size - start_ofs; + remainder = len % OFP_ACTION_ALIGN; + if (remainder) { + ofpbuf_put_zeros(b, OFP_ACTION_ALIGN - remainder); + } + nan->len = htons(b->size - start_ofs); } else if (!strcasecmp(act, "output")) { put_output_action(b, str_to_u32(arg)); } else if (!strcasecmp(act, "enqueue")) { @@ -345,20 +382,20 @@ parse_protocol(const char *name, const struct protocol **p_out) } #define FIELDS \ - FIELD(F_IN_PORT, "in_port", OFPFW_IN_PORT) \ - FIELD(F_DL_VLAN, "dl_vlan", OFPFW_DL_VLAN) \ - FIELD(F_DL_VLAN_PCP, "dl_vlan_pcp", OFPFW_DL_VLAN_PCP) \ - FIELD(F_DL_SRC, "dl_src", OFPFW_DL_SRC) \ - FIELD(F_DL_DST, "dl_dst", OFPFW_DL_DST) \ - FIELD(F_DL_TYPE, "dl_type", OFPFW_DL_TYPE) \ + FIELD(F_IN_PORT, "in_port", FWW_IN_PORT) \ + FIELD(F_DL_VLAN, "dl_vlan", 0) \ + FIELD(F_DL_VLAN_PCP, "dl_vlan_pcp", 0) \ + FIELD(F_DL_SRC, "dl_src", FWW_DL_SRC) \ + FIELD(F_DL_DST, "dl_dst", FWW_DL_DST) \ + FIELD(F_DL_TYPE, "dl_type", FWW_DL_TYPE) \ FIELD(F_NW_SRC, "nw_src", 0) \ FIELD(F_NW_DST, "nw_dst", 0) \ - FIELD(F_NW_PROTO, "nw_proto", OFPFW_NW_PROTO) \ - FIELD(F_NW_TOS, "nw_tos", OFPFW_NW_TOS) \ - FIELD(F_TP_SRC, "tp_src", OFPFW_TP_SRC) \ - FIELD(F_TP_DST, "tp_dst", OFPFW_TP_DST) \ - FIELD(F_ICMP_TYPE, "icmp_type", OFPFW_ICMP_TYPE) \ - FIELD(F_ICMP_CODE, "icmp_code", OFPFW_ICMP_CODE) + FIELD(F_NW_PROTO, "nw_proto", FWW_NW_PROTO) \ + FIELD(F_NW_TOS, "nw_tos", FWW_NW_TOS) \ + FIELD(F_TP_SRC, "tp_src", FWW_TP_SRC) \ + FIELD(F_TP_DST, "tp_dst", FWW_TP_DST) \ + FIELD(F_ICMP_TYPE, "icmp_type", FWW_TP_SRC) \ + FIELD(F_ICMP_CODE, "icmp_code", FWW_TP_DST) enum field_index { #define FIELD(ENUM, NAME, WILDCARD) ENUM, @@ -370,7 +407,7 @@ enum field_index { struct field { enum field_index index; const char *name; - uint32_t wildcard; + flow_wildcards_t wildcard; /* FWW_* bit. */ }; static bool @@ -543,6 +580,10 @@ parse_ofp_str(struct parsed_flow *pf, struct ofpbuf *actions, char *string) cls_rule_set_nw_src_masked(&pf->rule, 0, 0); } else if (f->index == F_NW_DST) { cls_rule_set_nw_dst_masked(&pf->rule, 0, 0); + } else if (f->index == F_DL_VLAN) { + cls_rule_set_any_vid(&pf->rule); + } else if (f->index == F_DL_VLAN_PCP) { + cls_rule_set_any_pcp(&pf->rule); } else { NOT_REACHED(); } @@ -571,8 +612,7 @@ parse_ofp_flow_mod_str(char *string, uint16_t command) parse_ofp_str(&pf, buffer, string); ofm = buffer->data; - flow_to_match(&pf.rule.flow, pf.rule.wc.wildcards, NXFF_OPENFLOW10, - &ofm->match); + ofputil_cls_rule_to_match(&pf.rule, NXFF_OPENFLOW10, &ofm->match); ofm->command = htons(command); ofm->cookie = htonll(pf.cookie); ofm->idle_timeout = htons(pf.idle_timeout);