#include <errno.h>
#include <stdlib.h>
+#include "autopath.h"
#include "byte-order.h"
#include "dynamic-string.h"
#include "netdev.h"
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")) {
/* 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)
{
* '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 = DS_EMPTY_INITIALIZER;
- bool ok = false;
-
- while (!ds_get_line(&s, stream)) {
- char *line = ds_cstr(&s);
- char *comment;
-
- /* Delete comments. */
- comment = strchr(line, '#');
- if (comment) {
- *comment = '\0';
- }
-
- /* Drop empty lines. */
- if (line[strspn(line, " \t\n")] == '\0') {
- continue;
- }
+ struct ds s;
+ bool ok;
- parse_ofp_flow_mod_str(packets, cur, line, OFPFC_ADD);
- ok = true;
- break;
+ ds_init(&s);
+ ok = ds_get_preprocessed_line(&s, stream) == 0;
+ if (ok) {
+ parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), command);
}
ds_destroy(&s);