On Tue, Nov 13, 2012 at 5:32 PM, Pravin B Shelar <pshe...@nicira.com> wrote:
> diff --git a/lib/odp-util.c b/lib/odp-util.c > index 08823e2..2a28504 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > @@ -418,36 +470,25 @@ parse_odp_action(const char *s, const struct simap > *port_names, > } else if (sscanf(s, "userspace(pid=%lli,slow_path(%n", &pid, &n) > > 0 > && n > 0) { > union user_action_cookie cookie; > + int res; > > cookie.type = USER_ACTION_COOKIE_SLOW_PATH; > cookie.slow_path.unused = 0; > cookie.slow_path.reason = 0; > > - while (s[n] != ')') { > - uint32_t bit; > - > - for (bit = 1; bit; bit <<= 1) { > - const char *reason = slow_path_reason_to_string(bit); > - size_t len = strlen(reason); > - > - if (reason > - && !strncmp(s + n, reason, len) > - && (s[n + len] == ',' || s[n + len] == ')')) > - { > - cookie.slow_path.reason |= bit; > - n += len + (s[n + len] == ','); > - break; > - } > - } > - > - if (!bit) { > - return -EINVAL; > - } > + res = parse_flags(&s[n], slow_path_reason_to_string, > + &cookie.slow_path.reason); > + if (res < 0) { > + return res; > + } > + if (cookie.slow_path.reason & ~(SLOW_MAX - 1)) { > + return -EINVAL; > } > I don't think there is any reason to reject unknown slow path reasons at this point. This is just converting the text into its binary equivalent so as long as we can parse it then it's fine. When it gets interpreted later it can be filtered out or rejected. I think this is the only use of SLOW_MAX as well so that will make things a little cleaner if we can remove it.
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev