From 72223f2a8b66bbb46ede20ef4c50622e4c60be44 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 13 Jun 2008 10:19:46 -0700 Subject: [PATCH] Make flow specifications more general in dpctl: - More special port names. - Allow fields to be comma-separated, for use on command line. - Allow ANY as a synonym for *, to avoid globbing on command line. --- utilities/dpctl.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utilities/dpctl.c b/utilities/dpctl.c index 24b43db29..f0c34be0b 100644 --- a/utilities/dpctl.c +++ b/utilities/dpctl.c @@ -501,10 +501,16 @@ str_to_action(const char *str, struct ofp_action *action) { uint16_t port; - if (!strcasecmp(str, "flood")) { + if (!strcasecmp(str, "normal")) { + port = OFPP_NORMAL; + } else if (!strcasecmp(str, "flood")) { port = OFPP_FLOOD; + } else if (!strcasecmp(str, "all")) { + port = OFPP_ALL; } else if (!strcasecmp(str, "controller")) { port = OFPP_CONTROLLER; + } else if (!strcasecmp(str, "local")) { + port = OFPP_LOCAL; } else { port = str_to_int(str); } @@ -551,9 +557,9 @@ str_to_flow(char *string, struct ofp_match *match, struct ofp_action *action, } memset(match, 0, sizeof *match); wildcards = OFPFW_ALL; - for (name = strtok(string, "="), value = strtok(NULL, " \t\n"); + for (name = strtok(string, "="), value = strtok(NULL, ", \t\r\n"); name && value; - name = strtok(NULL, "="), value = strtok(NULL, " \t\n")) + name = strtok(NULL, "="), value = strtok(NULL, ", \t\r\n")) { const struct field *f; void *data; @@ -592,7 +598,7 @@ str_to_flow(char *string, struct ofp_match *match, struct ofp_action *action, found: data = (char *) match + f->offset; - if (!strcmp(value, "*")) { + if (!strcmp(value, "*") || !strcmp(value, "ANY")) { wildcards |= f->wildcard; } else { wildcards &= ~f->wildcard; -- 2.43.0