in_port_s = strsep(&arg, ",");
if (in_port_s && in_port_s[0]) {
- resubmit->in_port = ofputil_port_from_string(in_port_s);
- if (!resubmit->in_port) {
+ if (!ofputil_port_from_string(in_port_s, &resubmit->in_port)) {
ovs_fatal(0, "%s: resubmit to unknown port", in_port_s);
}
} else {
}
static void
-parse_dec_ttl(struct ofpbuf *b, char *arg)
+parse_noargs_dec_ttl(struct ofpbuf *b, enum ofputil_action_code compat)
{
struct ofpact_cnt_ids *ids;
+ uint16_t id = 0;
ids = ofpact_put_DEC_TTL(b);
+ ids->ofpact.compat = compat;
+ ofpbuf_put(b, &id, sizeof id);
+ ids = b->l2;
+ ids->n_controllers++;
+ ofpact_update_len(b, &ids->ofpact);
+}
+static void
+parse_dec_ttl(struct ofpbuf *b, char *arg, enum ofputil_action_code compat)
+{
if (*arg == '\0') {
- uint16_t id = 0;
-
- ids->ofpact.compat = OFPUTIL_NXAST_DEC_TTL;
- ofpbuf_put(b, &id, sizeof id);
- ids = b->l2;
- ids->n_controllers++;
+ parse_noargs_dec_ttl(b, compat);
} else {
+ struct ofpact_cnt_ids *ids;
char *cntr;
+ ids = ofpact_put_DEC_TTL(b);
ids->ofpact.compat = OFPUTIL_NXAST_DEC_TTL_CNT_IDS;
for (cntr = strtok_r(arg, ", ", &arg); cntr != NULL;
cntr = strtok_r(NULL, ", ", &arg)) {
ovs_fatal(0, "dec_ttl_cnt_ids: expected at least one controller "
"id.");
}
-
+ ofpact_update_len(b, &ids->ofpact);
}
- ofpact_update_len(b, &ids->ofpact);
}
static void
break;
case OFPUTIL_OFPAT10_STRIP_VLAN:
+ case OFPUTIL_OFPAT11_POP_VLAN:
ofpact_put_STRIP_VLAN(ofpacts);
break;
ofpact_put_SET_IPV4_DSCP(ofpacts)->dscp = tos;
break;
+ case OFPUTIL_OFPAT11_DEC_NW_TTL:
+ parse_noargs_dec_ttl(ofpacts, code);
+ break;
+
case OFPUTIL_OFPAT10_SET_TP_SRC:
case OFPUTIL_OFPAT11_SET_TP_SRC:
ofpact_put_SET_L4_SRC_PORT(ofpacts)->port = str_to_u32(arg);
break;
case OFPUTIL_NXAST_DEC_TTL:
- parse_dec_ttl(ofpacts, arg);
+ parse_dec_ttl(ofpacts, arg, code);
break;
case OFPUTIL_NXAST_FIN_TIMEOUT:
}
return false;
} else {
- uint16_t port = ofputil_port_from_string(act);
- if (port) {
+ uint16_t port;
+ if (ofputil_port_from_string(act, &port)) {
ofpact_put_OUTPUT(ofpacts)->port = port;
} else {
ovs_fatal(0, "Unknown action: %s", act);
if (!strcmp(name, "table")) {
fm->table_id = str_to_table_id(value);
} else if (!strcmp(name, "out_port")) {
- fm->out_port = ofputil_port_from_string(name);
- if (!fm->out_port) {
+ if (!ofputil_port_from_string(name, &fm->out_port)) {
ofp_fatal(str_, verbose, "%s is not a valid OpenFlow port",
name);
}