* Returns NULL if successful, otherwise a malloc()'d string describing the
* error. The caller is responsible for freeing the returned string. */
char * WARN_UNUSED_RESULT
-str_to_mac(const char *str, uint8_t mac[6])
+str_to_mac(const char *str, uint8_t mac[ETH_ADDR_LEN])
{
if (!ovs_scan(str, ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mac))) {
return xasprintf("invalid mac address %s", str);
enum {
F_OUT_PORT = 1 << 0,
F_ACTIONS = 1 << 1,
+ F_IMPORTANCE = 1 << 2,
F_TIMEOUT = 1 << 3,
F_PRIORITY = 1 << 4,
F_FLAGS = 1 << 5,
break;
case OFPFC_ADD:
- fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY | F_FLAGS;
+ fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY | F_FLAGS | F_IMPORTANCE;
break;
case OFPFC_DELETE:
fm->buffer_id = UINT32_MAX;
fm->out_port = OFPP_ANY;
fm->flags = 0;
+ fm->importance = 0;
fm->out_group = OFPG11_ANY;
fm->delete_reason = OFPRR_DELETE;
if (fields & F_ACTIONS) {
error = str_to_u16(value, name, &fm->idle_timeout);
} else if (fields & F_TIMEOUT && !strcmp(name, "hard_timeout")) {
error = str_to_u16(value, name, &fm->hard_timeout);
+ } else if (fields & F_IMPORTANCE && !strcmp(name, "importance")) {
+ error = str_to_u16(value, name, &fm->importance);
} else if (!strcmp(name, "cookie")) {
char *mask = strchr(value, '/');
if (error) {
return error;
}
- if (mm->meter.meter_id > OFPM13_MAX) {
+ if (mm->meter.meter_id > OFPM13_MAX
+ || !mm->meter.meter_id) {
return xasprintf("invalid value for %s", name);
}
}
const char *str_, char *string,
enum ofputil_protocol *usable_protocols)
{
- static atomic_uint32_t id = ATOMIC_VAR_INIT(0);
+ static atomic_count id = ATOMIC_COUNT_INIT(0);
char *save_ptr = NULL;
char *name;
- atomic_add(&id, 1, &fmr->id);
+ fmr->id = atomic_count_inc(&id);
fmr->flags = (NXFMF_INITIAL | NXFMF_ADD | NXFMF_DELETE | NXFMF_MODIFY
| NXFMF_OWN | NXFMF_ACTIONS);