X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-parse.c;h=f45c450c65ca4b07cfed86fa554d3c753e9cf568;hb=eeba8e4fd3b9ae3c69fbf3ae9ef28a55184ac12a;hp=f1a4cb44967c4f53595a779783f4a399ad52954a;hpb=dd8101bc538cdad7a99f61666760fa79e6c047af;p=openvswitch diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index f1a4cb44..f45c450c 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -22,6 +22,7 @@ #include #include +#include "autopath.h" #include "byte-order.h" #include "dynamic-string.h" #include "netdev.h" @@ -453,6 +454,10 @@ str_to_action(char *str, struct ofpbuf *b) struct nx_action_multipath *nam; nam = ofpbuf_put_uninit(b, sizeof *nam); multipath_parse(nam, arg); + } else if (!strcasecmp(act, "autopath")) { + struct nx_action_autopath *naa; + naa = ofpbuf_put_uninit(b, sizeof *naa); + autopath_parse(naa, arg); } else if (!strcasecmp(act, "output")) { put_output_action(b, str_to_u32(arg)); } else if (!strcasecmp(act, "enqueue")) { @@ -726,7 +731,7 @@ parse_reg_value(struct cls_rule *rule, int reg_idx, const char *value) /* Convert 'string' (as described in the Flow Syntax section of the ovs-ofctl * man page) into 'pf'. If 'actions' is specified, an action must be in * 'string' and may be expanded or reallocated. */ -static void +void parse_ofp_str(struct flow_mod *fm, uint8_t *table_idx, struct ofpbuf *actions, char *string) { @@ -820,7 +825,8 @@ parse_ofp_str(struct flow_mod *fm, uint8_t *table_idx, } else { parse_field_value(&fm->cr, f->index, value); } - } else if (!strncmp(name, "reg", 3) && isdigit(name[3])) { + } else if (!strncmp(name, "reg", 3) + && isdigit((unsigned char) name[3])) { unsigned int reg_idx = atoi(name + 3); if (reg_idx >= FLOW_N_REGS) { ovs_fatal(0, "only %d registers supported", FLOW_N_REGS); @@ -853,7 +859,7 @@ parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur_format, parse_ofp_str(&fm, NULL, is_del ? NULL : &actions, string); fm.command = command; - min_format = ofputil_min_flow_format(&fm.cr, true, fm.cookie); + min_format = ofputil_min_flow_format(&fm.cr); next_format = MAX(*cur_format, min_format); if (next_format != *cur_format) { struct ofpbuf *sff = ofputil_make_set_flow_format(next_format); @@ -871,8 +877,8 @@ parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur_format, * 'stream' and the command is always OFPFC_ADD. Returns false if end-of-file * is reached before reading a flow, otherwise true. */ bool -parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur, - FILE *stream) +parse_ofp_flow_mod_file(struct list *packets, enum nx_flow_format *cur, + FILE *stream, uint16_t command) { struct ds s; bool ok; @@ -880,7 +886,7 @@ parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur, ds_init(&s); ok = ds_get_preprocessed_line(&s, stream) == 0; if (ok) { - parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), OFPFC_ADD); + parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), command); } ds_destroy(&s);