[ovs-dev] [PATCH] secchan: Clarify logic in add_output_action().

Justin Pettit jpettit at nicira.com
Fri Oct 2 23:03:35 UTC 2009


Looks fine to me.

--Justin


On Oct 2, 2009, at 4:01 PM, Ben Pfaff wrote:

> The code and the logic here was too terse for anyone to reasonably
> understand it.  Add some comments.
>
> This should not cause any behavioral change.
>
> CC: Jean Tourrilhes <jt at hpl.hp.com>
> ---
> secchan/ofproto.c |   16 ++++++++++++++--
> 1 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/secchan/ofproto.c b/secchan/ofproto.c
> index de1252a..9836e0f 100644
> --- a/secchan/ofproto.c
> +++ b/secchan/ofproto.c
> @@ -1930,9 +1930,21 @@ static void
> add_output_action(struct action_xlate_ctx *ctx, uint16_t port)
> {
>     const struct ofport *ofport = port_array_get(&ctx->ofproto- 
> >ports, port);
> -    if (!ofport || !(ofport->opp.config & OFPPC_NO_FWD)) {
> -        odp_actions_add(ctx->out, ODPAT_OUTPUT)->output.port = port;
> +
> +    if (ofport) {
> +        if (ofport->opp.config & OFPPC_NO_FWD) {
> +            /* Forwarding disabled on port. */
> +            return;
> +        }
> +    } else {
> +        /*
> +         * We don't have an ofport record for this port, but it  
> doesn't hurt to
> +         * allow forwarding to it anyhow.  Maybe such a port will  
> appear later
> +         * and we're pre-populating the flow table.
> +         */
>     }
> +
> +    odp_actions_add(ctx->out, ODPAT_OUTPUT)->output.port = port;
> }
>
> static struct rule *
> -- 
> 1.6.3.3
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list