return value;
}
+static uint64_t
+str_to_u64(const char *str)
+{
+ char *tail;
+ uint64_t value;
+
+ errno = 0;
+ value = strtoull(str, &tail, 0);
+ if (errno == EINVAL || errno == ERANGE || *tail) {
+ ovs_fatal(0, "invalid numeric format %s", str);
+ }
+ return value;
+}
+
static void
str_to_mac(const char *str, uint8_t mac[6])
{
struct ofp_action_nw_tos *nt;
nt = put_action(b, sizeof *nt, OFPAT_SET_NW_TOS);
nt->nw_tos = str_to_u32(arg);
+ } else if (!strcasecmp(act, "resubmit")) {
+ struct nx_action_resubmit *nar;
+ nar = put_action(b, sizeof *nar, OFPAT_VENDOR);
+ nar->vendor = htonl(NX_VENDOR_ID);
+ nar->subtype = htons(NXAST_RESUBMIT);
+ nar->in_port = htons(str_to_u32(arg));
} else if (!strcasecmp(act, "output")) {
put_output_action(b, str_to_u32(arg));
} else if (!strcasecmp(act, "drop")) {
/* Unless a numeric argument is specified, we send the whole
* packet to the controller. */
- if (arg && (strspn(act, "0123456789") == strlen(act))) {
+ if (arg && (strspn(arg, "0123456789") == strlen(arg))) {
oao->max_len = htons(str_to_u32(arg));
} else {
oao->max_len = htons(UINT16_MAX);
if (!act_str) {
ovs_fatal(0, "must specify an action");
}
- *(act_str-1) = '\0';
+ *act_str = '\0';
- act_str = strchr(act_str, '=');
+ act_str = strchr(act_str + 1, '=');
if (!act_str) {
ovs_fatal(0, "must specify an action");
}
} else if (hard_timeout && !strcmp(name, "hard_timeout")) {
*hard_timeout = atoi(value);
} else if (cookie && !strcmp(name, "cookie")) {
- *cookie = atoi(value);
+ *cookie = str_to_u64(value);
} else if (parse_field(name, &f)) {
void *data = (char *) match + f->offset;
if (!strcmp(value, "*") || !strcmp(value, "ANY")) {