Hey Ben, Looks good to me.
thanx! mehak On Thu, Jul 12, 2012 at 12:29 PM, Ben Pfaff <b...@nicira.com> wrote: > Commit 0c449c5683a improved action error logging for one case, but we might > as well do it for the other case too. > > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/ofp-actions.c | 31 +++++++++++++++++++------------ > 1 files changed, 19 insertions(+), 12 deletions(-) > > diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c > index 93f6bf7..a39a670 100644 > --- a/lib/ofp-actions.c > +++ b/lib/ofp-actions.c > @@ -434,6 +434,21 @@ action_is_valid(const union ofp_action *a, size_t > n_actions) > ((LEFT) -= ntohs((ITER)->header.len) / sizeof(union ofp_action), > \ > (ITER) = action_next(ITER))) > > +static void > +log_bad_action(const union ofp_action *actions, size_t n_actions, size_t > ofs, > + enum ofperr error) > +{ > + if (!VLOG_DROP_WARN(&rl)) { > + struct ds s; > + > + ds_init(&s); > + ds_put_hex_dump(&s, actions, n_actions * sizeof *actions, 0, > false); > + VLOG_WARN("bad action at offset %#x (%s):\n%s", > + ofs * sizeof *actions, ofperr_get_name(error), > ds_cstr(&s)); > + ds_destroy(&s); > + } > +} > + > static enum ofperr > ofpacts_from_openflow10(const union ofp_action *in, size_t n_in, > struct ofpbuf *out) > @@ -444,22 +459,14 @@ ofpacts_from_openflow10(const union ofp_action *in, > size_t n_in, > ACTION_FOR_EACH (a, left, in, n_in) { > enum ofperr error = ofpact_from_openflow10(a, out); > if (error) { > - VLOG_WARN_RL(&rl, "bad action at offset %td (%s)", > - (a - in) * sizeof *a, ofperr_get_name(error)); > + log_bad_action(in, n_in, a - in, error); > return error; > } > } > if (left) { > - if (!VLOG_DROP_WARN(&rl)) { > - struct ds s; > - > - ds_init(&s); > - ds_put_hex_dump(&s, in, n_in * sizeof *a, 0, false); > - VLOG_WARN("bad action format at offset %#x:\n%s", > - (n_in - left) * sizeof *a, ds_cstr(&s)); > - ds_destroy(&s); > - } > - return OFPERR_OFPBAC_BAD_LEN; > + enum ofperr error = OFPERR_OFPBAC_BAD_LEN; > + log_bad_action(in, n_in, n_in - left, error); > + return error; > } > > ofpact_pad(out); > -- > 1.7.2.5 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev