When "dec_ttl" is specified as the name of an action, in OpenFlow 1.1 and
later we should prefer to use the standardized action, rather than the
Nicira extension.
Reported-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
oao->max_len = htons(output->max_len);
}
oao->max_len = htons(output->max_len);
}
+static void
+ofpact_dec_ttl_to_openflow11(const struct ofpact_cnt_ids *dec_ttl,
+ struct ofpbuf *out)
+{
+ if (dec_ttl->n_controllers == 1 && dec_ttl->cnt_ids[0] == 0
+ && (!dec_ttl->ofpact.compat ||
+ dec_ttl->ofpact.compat == OFPUTIL_OFPAT11_DEC_NW_TTL)) {
+ ofputil_put_OFPAT11_DEC_NW_TTL(out);
+ } else {
+ ofpact_dec_ttl_to_nxast(dec_ttl, out);
+ }
+}
+
static void
ofpact_to_openflow11(const struct ofpact *a, struct ofpbuf *out)
{
static void
ofpact_to_openflow11(const struct ofpact *a, struct ofpbuf *out)
{
break;
case OFPACT_DEC_TTL:
break;
case OFPACT_DEC_TTL:
- if (a->compat == OFPUTIL_OFPAT11_DEC_NW_TTL) {
- ofputil_put_OFPAT11_DEC_NW_TTL(out);
- } else {
- ofpact_to_nxast(a, out);
- }
+ ofpact_dec_ttl_to_openflow11(ofpact_get_DEC_TTL(a), out);
break;
case OFPACT_CLEAR_ACTIONS:
break;
case OFPACT_CLEAR_ACTIONS:
-parse_noargs_dec_ttl(struct ofpbuf *b, enum ofputil_action_code compat)
+parse_noargs_dec_ttl(struct ofpbuf *b)
{
struct ofpact_cnt_ids *ids;
uint16_t id = 0;
ids = ofpact_put_DEC_TTL(b);
{
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++;
ofpbuf_put(b, &id, sizeof id);
ids = b->l2;
ids->n_controllers++;
-parse_dec_ttl(struct ofpbuf *b, char *arg, enum ofputil_action_code compat)
+parse_dec_ttl(struct ofpbuf *b, char *arg)
- parse_noargs_dec_ttl(b, compat);
+ parse_noargs_dec_ttl(b);
} else {
struct ofpact_cnt_ids *ids;
char *cntr;
} else {
struct ofpact_cnt_ids *ids;
char *cntr;
break;
case OFPUTIL_NXAST_DEC_TTL:
break;
case OFPUTIL_NXAST_DEC_TTL:
- parse_dec_ttl(ofpacts, arg, code);
+ parse_dec_ttl(ofpacts, arg);
break;
case OFPUTIL_NXAST_FIN_TIMEOUT:
break;
case OFPUTIL_NXAST_FIN_TIMEOUT: