On Tue, Jun 26, 2012 at 05:02:22PM -0700, ravi kerur wrote:
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 7b86f80..319033c 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
...
> @@ -5125,6 +5132,76 @@ compose_dec_ttl(struct action_xlate_ctx *ctx)
>  }
>  
>  static void
> +commit_dec_mpls_ttl_action(struct action_xlate_ctx *ctx)
> +{
> +    uint8_t ttl = mpls_lse_to_ttl(ctx->flow.mpls_lse);
> +    if (ttl > 1) {
> +        if (ctx->flow.mpls_lse != htonl(0)) {
> +            flow_set_mpls_lse_ttl(&ctx->flow.mpls_lse, --ttl);
> +        }
> +        if (ctx->base_flow.mpls_lse != htonl(0)) {
> +            flow_set_mpls_lse_ttl(&ctx->base_flow.mpls_lse, --ttl);
> +        }
> +        nl_msg_put_u8(ctx->odp_actions, OVS_ACTION_ATTR_DEC_MPLS_TTL, ttl);
> +    } else {
> +        execute_controller_action(ctx, UINT16_MAX, OFPR_INVALID_TTL, 0);
> +    }
> +}
> +

This may decrease ttl by 2.

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index a2a05aa..58e53d7 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5158,11 +5158,12 @@ commit_dec_mpls_ttl_action(struct action_xlate_ctx *ctx)
     assert(ctx->mpls.n_lses > 0);
 
     if (ttl > 1) {
+        ttl--;
         if (ctx->flow.mpls_lse != htonl(0)) {
-            flow_set_mpls_lse_ttl(&ctx->flow.mpls_lse, --ttl);
+            flow_set_mpls_lse_ttl(&ctx->flow.mpls_lse, ttl);
         }
         if (ctx->base_flow.mpls_lse != htonl(0)) {
-            flow_set_mpls_lse_ttl(&ctx->base_flow.mpls_lse, --ttl);
+            flow_set_mpls_lse_ttl(&ctx->base_flow.mpls_lse, ttl);
         }
         mpls_lses_set(&ctx->mpls, ctx->flow.mpls_lse);
         nl_msg_put_u8(ctx->odp_actions, OVS_ACTION_ATTR_DEC_MPLS_TTL, ttl);


-- 
yamahata
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to