The logic of ofpacts_from_openflow11() should be same to ofpacts_from_openflow10(), so consolidate them. Thus the issue is fixed.
Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp> --- v2 slightly modified --- lib/ofp-actions.c | 34 +++++++++++++--------------------- 1 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 705b3b2..1a45ab2 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -435,14 +435,16 @@ action_is_valid(const union ofp_action *a, size_t n_actions) (ITER) = action_next(ITER))) static enum ofperr -ofpacts_from_openflow10(const union ofp_action *in, size_t n_in, - struct ofpbuf *out) +ofpacts_from_openflow(const union ofp_action *in, size_t n_in, + struct ofpbuf *out, + enum ofperr (ofpact_from_openflow)( + const union ofp_action *a, struct ofpbuf *out)) { const union ofp_action *a; size_t left; ACTION_FOR_EACH (a, left, in, n_in) { - enum ofperr error = ofpact_from_openflow10(a, out); + enum ofperr error = ofpact_from_openflow(a, out); if (error) { VLOG_WARN_RL(&rl, "bad action at offset %td (%s)", (a - in) * sizeof *a, ofperr_get_name(error)); @@ -460,6 +462,13 @@ ofpacts_from_openflow10(const union ofp_action *in, size_t n_in, return 0; } +static enum ofperr +ofpacts_from_openflow10(const union ofp_action *in, size_t n_in, + struct ofpbuf *out) +{ + return ofpacts_from_openflow(in, n_in, out, ofpact_from_openflow10); +} + /* Attempts to convert 'actions_len' bytes of OpenFlow actions from the front * of 'openflow' into ofpacts. On success, replaces any existing content in * 'ofpacts' by the converted ofpacts; on failure, clears 'ofpacts'. Returns 0 @@ -633,24 +642,7 @@ static enum ofperr ofpacts_from_openflow11(const union ofp_action *in, size_t n_in, struct ofpbuf *out) { - const union ofp_action *a; - size_t left; - - ACTION_FOR_EACH (a, left, in, n_in) { - enum ofperr error = ofpact_from_openflow11(a, out); - if (error) { - VLOG_WARN_RL(&rl, "bad action at offset %td (%s)", - (a - in) * sizeof *a, ofperr_get_name(error)); - return error; - } - } - if (left) { - VLOG_WARN_RL(&rl, "bad action format at offset %zu", - (n_in - left) * sizeof *a); - return OFPERR_OFPBAC_BAD_LEN; - } - - return 0; + return ofpacts_from_openflow(in, n_in, out, ofpact_from_openflow11); } /* OpenFlow 1.1 instructions. */ -- 1.7.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev