Subject: Re: [PATCH v2.40 4/7] ofp-actions: Add separate OpenFlow 1.3 action parser

From: Ben Pfaff <[email-masked]>
Date: Fri, 27 Sep 2013 12:41:19 -0700

On Fri, Sep 27, 2013 at 09:18:33AM +0900, Simon Horman wrote:
> From: Joe Stringer <[email-masked]>
> 
> This patch adds new ofpact_from_openflow13() and
> ofpacts_from_openflow13() functions parallel to the existing ofpact
> handling code. In the OpenFlow 1.3 version, push_mpls is handled
> differently, but all other actions are handled by the existing code.
> 
> For push_mpls, ofpact_push_mpls.ofpact.compat is set to
> OFPUTIL_OFPAT13_PUSH_MPLS, which allows correct VLAN+MPLS datapath
> behaviour to be determined at odp translation time.
> 
> Signed-off-by: Joe Stringer <[email-masked]>
> Signed-off-by: Simon Horman <[email-masked]>

I am nervous about this idea of having ofpacts_pull_openflow11_actions()
and ofpacts_pull_openflow11_instructions() try to figure out what
version of OpenFlow is involved.  It is a new and somewhat surprising
requirements that the callers provide not just actions or instructions
but a complete OpenFlow message.  I see that the callers in ovs-ofctl.c
don't satisfy this requirement.

I think that it would be better to make these functions' callers say
what version of OpenFlow they are working with.  One could provide a
helper function like get_version_from_ofpbuf(), which should probably go
in ofp-util.c, but I would want it to fail (assert-fail or segfault or
whatever) if there is no L2 header pointer, instead of returning a
default value (that, in this case anyway, we know must be wrong because
OF1.0 never contains OF1.1+ actions or instructions).

Thanks,

Ben.