[ovs-dev] [mirror 03/13] ofproto-dpif: Make compose_mirror_dsts() harder to screw up.

Justin Pettit jpettit at nicira.com
Fri Nov 11 02:52:50 UTC 2011


Looks good.

--Justin


On Oct 26, 2011, at 10:09 AM, Ben Pfaff wrote:

> I came close to add a "continue;" inside the main "while" loop in
> compose_mirror_dsts(), which would have turned it into an infinite loop.
> This commit changes it to a "for" loop that is harder to screw up.
> ---
> ofproto/ofproto-dpif.c |    3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index a568ea9..af94d54 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -4654,7 +4654,7 @@ compose_mirror_dsts(struct action_xlate_ctx *ctx,
>     }
> 
>     flow_vid = vlan_tci_to_vid(ctx->flow.vlan_tci);
> -    while (mirrors) {
> +    for (; mirrors; mirrors &= mirrors - 1) {
>         struct ofmirror *m = ofproto->mirrors[mirror_mask_ffs(mirrors) - 1];
>         if (vlan_is_mirrored(m, vlan)) {
>             struct dst dst;
> @@ -4689,7 +4689,6 @@ compose_mirror_dsts(struct action_xlate_ctx *ctx,
>                 }
>             }
>         }
> -        mirrors &= mirrors - 1;
>     }
> }
> 
> -- 
> 1.7.2.5
> 




More information about the dev mailing list