On Fri, Aug 30, 2013 at 01:40:16PM -0700, Jarno Rajahalme wrote:
> Indirect groups can have at most one bucket.
> 
> Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>

Reviewed-by: Simon Horman <ho...@verge.net.au>

> ---
>  lib/ofp-parse.c |   14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
> index 9098467..f17364f 100644
> --- a/lib/ofp-parse.c
> +++ b/lib/ofp-parse.c
> @@ -2075,9 +2075,17 @@ parse_ofp_group_mod_str__(struct ofputil_group_mod 
> *gm, uint16_t command,
>          goto out;
>      }
>      /* Validate buckets. */
> -    LIST_FOR_EACH(bucket, list_node, &gm->buckets) {
> -        if (bucket->weight != 1 && gm->type != OFPGT11_SELECT) {
> -            error = xstrdup("Only select groups can have bucket weights.");
> +    {
> +        size_t n_buckets = 0;
> +        LIST_FOR_EACH(bucket, list_node, &gm->buckets) {
> +            ++n_buckets;

Any reason you favour a pre-increment over a post-increment.
I realise it makes no difference to the logic here but I am curious.

> +            if (bucket->weight != 1 && gm->type != OFPGT11_SELECT) {
> +                error = xstrdup("Only select groups can have bucket 
> weights.");
> +                goto out;
> +            }
> +        }
> +        if (gm->type == OFPGT11_INDIRECT && n_buckets > 1) {
> +            error = xstrdup("Indirect groups can have at most one bucket.");
>              goto out;
>          }
>      }
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> 
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to