Looks good. Reviewed-by: Isaku Yamahata <yamah...@valinux.co.jp> On Thu, Oct 18, 2012 at 11:13:05AM -0700, Ben Pfaff wrote: > 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 <yamah...@valinux.co.jp> > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/ofp-actions.c | 19 ++++++++++++++----- > lib/ofp-parse.c | 9 ++++----- > 2 files changed, 18 insertions(+), 10 deletions(-) > > diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c > index b774a61..ae20f8e 100644 > --- a/lib/ofp-actions.c > +++ b/lib/ofp-actions.c > @@ -1426,6 +1426,19 @@ ofpact_output_to_openflow11(const struct ofpact_output > *output, > } > > 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) > { > switch (a->type) { > @@ -1486,11 +1499,7 @@ ofpact_to_openflow11(const struct ofpact *a, struct > ofpbuf *out) > 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: > diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c > index a9d70de..f8cbcc6 100644 > --- a/lib/ofp-parse.c > +++ b/lib/ofp-parse.c > @@ -279,13 +279,12 @@ parse_controller(struct ofpbuf *b, char *arg) > } > > static void > -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); > - ids->ofpact.compat = compat; > ofpbuf_put(b, &id, sizeof id); > ids = b->l2; > ids->n_controllers++; > @@ -293,10 +292,10 @@ parse_noargs_dec_ttl(struct ofpbuf *b, enum > ofputil_action_code compat) > } > > static void > -parse_dec_ttl(struct ofpbuf *b, char *arg, enum ofputil_action_code compat) > +parse_dec_ttl(struct ofpbuf *b, char *arg) > { > if (*arg == '\0') { > - parse_noargs_dec_ttl(b, compat); > + parse_noargs_dec_ttl(b); > } else { > struct ofpact_cnt_ids *ids; > char *cntr; > @@ -516,7 +515,7 @@ parse_named_action(enum ofputil_action_code code, const > struct flow *flow, > break; > > case OFPUTIL_NXAST_DEC_TTL: > - parse_dec_ttl(ofpacts, arg, code); > + parse_dec_ttl(ofpacts, arg); > break; > > case OFPUTIL_NXAST_FIN_TIMEOUT: > -- > 1.7.10.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
-- yamahata _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev