default:
ds_put_format(string, " cmd:%d ", ntohs(ofm->command));
}
- ds_put_format(string, "cookie:%"PRIx64" idle:%d hard:%d pri:%d "
+ ds_put_format(string, "cookie:0x%"PRIx64" idle:%d hard:%d pri:%d "
"buf:%#x flags:%"PRIx16" ", ntohll(ofm->cookie),
ntohs(ofm->idle_timeout), ntohs(ofm->hard_timeout),
ofm->match.wildcards ? ntohs(ofm->priority) : (uint16_t)-1,
break;
}
ds_put_format(string,
- " cookie%"PRIx64" pri%"PRIu16" secs%"PRIu32" nsecs%"PRIu32
+ " cookie0x%"PRIx64" pri%"PRIu16" secs%"PRIu32" nsecs%"PRIu32
" idle%"PRIu16" pkts%"PRIu64" bytes%"PRIu64"\n",
ntohll(ofr->cookie),
ofr->match.wildcards ? ntohs(ofr->priority) : (uint16_t)-1,
break;
}
- ds_put_format(string, " cookie=%"PRIu64", ", ntohll(fs->cookie));
+ ds_put_format(string, " cookie=0x%"PRIx64", ", ntohll(fs->cookie));
ds_put_format(string, "duration_sec=%"PRIu32"s, ",
ntohl(fs->duration_sec));
ds_put_format(string, "duration_nsec=%"PRIu32"ns, ",
not yet expose to the user.)
.
.PP
+The \fBadd\-flow\fR, \fBadd\-flows\fR, and \fBmod\-flows\fR commands
+support an additional optional field:
+.
+.IP \fBcookie=\fIvalue\fR
+.
+A cookie is an opaque identifier that can be associated with the flow.
+\fIvalue\fR can be any 64-bit number and need not be unique among
+flows.
+.
+.PP
The \fBadd-flow\fR, \fBadd-flows\fR, and \fBdel-flows\fR commands
support an additional optional field:
.
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])
{
} 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")) {