[ovs-dev] [nxm 38/42] ofp-util: Make validate_actions() take a struct flow *.

Justin Pettit jpettit at nicira.com
Tue Nov 9 22:42:16 UTC 2010


Looks good.

--Justin


On Oct 28, 2010, at 10:28 AM, Ben Pfaff wrote:

> The upcoming support for actions on registers will require the flow to
> validate actions, so this commit adds the parameter in advance.  It is
> not yet used.
> ---
> lib/ofp-util.c    |    2 +-
> lib/ofp-util.h    |    2 +-
> ofproto/ofproto.c |    5 +++--
> 3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 7856438..d4e1595 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -612,7 +612,7 @@ check_action(const union ofp_action *a, unsigned int len, int max_ports)
> 
> int
> validate_actions(const union ofp_action *actions, size_t n_actions,
> -                 int max_ports)
> +                 const struct flow *flow OVS_UNUSED, int max_ports)
> {
>     size_t i;
> 
> diff --git a/lib/ofp-util.h b/lib/ofp-util.h
> index a10a143..3855f56 100644
> --- a/lib/ofp-util.h
> +++ b/lib/ofp-util.h
> @@ -78,7 +78,7 @@ const union ofp_action *actions_first(struct actions_iterator *,
>                                       size_t n_actions);
> const union ofp_action *actions_next(struct actions_iterator *);
> int validate_actions(const union ofp_action *, size_t n_actions,
> -                     int max_ports);
> +                     const struct flow *, int max_ports);
> bool action_outputs_to_port(const union ofp_action *, uint16_t port);
> 
> void normalize_match(struct ofp_match *);
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 3e6d758..9ed7790 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -2935,7 +2935,7 @@ handle_packet_out(struct ofproto *p, struct ofconn *ofconn,
>     /* Extract flow, check actions. */
>     flow_extract(&payload, 0, ofp_port_to_odp_port(ntohs(opo->in_port)),
>                  &flow);
> -    error = validate_actions(ofp_actions, n_ofp_actions, p->max_ports);
> +    error = validate_actions(ofp_actions, n_ofp_actions, &flow, p->max_ports);
>     if (error) {
>         goto exit;
>     }
> @@ -4028,7 +4028,8 @@ flow_mod_core(struct ofproto *p, struct ofconn *ofconn, struct flow_mod *fm)
>         return error;
>     }
> 
> -    error = validate_actions(fm->actions, fm->n_actions, p->max_ports);
> +    error = validate_actions(fm->actions, fm->n_actions,
> +                             &fm->cr.flow, p->max_ports);
>     if (error) {
>         return error;
>     }
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list