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> --- lib/ofp-actions.c | 44 +++++++++++++++----------------------------- 1 files changed, 15 insertions(+), 29 deletions(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index ba9e61c..48066f5 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)); @@ -461,6 +463,13 @@ ofpacts_from_openflow10(const union ofp_action *in, size_t n_in, } 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); +} + +static enum ofperr ofpacts_pull_actions(struct ofpbuf *openflow, unsigned int actions_len, struct ofpbuf *ofpacts, enum ofperr (*translate)(const union ofp_action *actions, @@ -643,24 +652,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. */ @@ -827,14 +819,8 @@ ofpacts_pull_openflow11_actions(struct ofpbuf *openflow, unsigned int actions_len, struct ofpbuf *ofpacts) { - enum ofperr error; - - error = ofpacts_pull_actions(openflow, actions_len, ofpacts, - ofpacts_from_openflow11); - if (!error) { - ofpact_put_END(ofpacts); - } - return error; + return ofpacts_pull_actions(openflow, actions_len, ofpacts, + ofpacts_from_openflow11); } enum ofperr -- 1.7.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev