[ovs-dev] [PATCH 1/2] ofproto-dpif-xlate: Do not push LSE to flow if its label stack is full

Ben Pfaff blp at nicira.com
Mon Feb 3 19:10:53 UTC 2014


On Wed, Jan 29, 2014 at 04:20:52PM +0900, Simon Horman wrote:
> If a pop is composed on a flow whose label stack is already full
> it should not call flow_push_mpls() as that function can't do
> anything useful (it aborts) given that the label stack is full.
> 
> Signed-off-by: Simon Horman <horms at verge.net.au>
> ---
>  ofproto/ofproto-dpif-xlate.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index 3ae6a29..24bfc42 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -2131,6 +2131,7 @@ compose_mpls_push_action(struct xlate_ctx *ctx, struct ofpact_push_mpls *mpls)
>      } else if (n >= ctx->xbridge->max_mpls_depth) {
>          COVERAGE_INC(xlate_actions_mpls_overflow);
>          ctx->xout->slow |= SLOW_ACTION;
> +        return;
>      }
>  
>      flow_push_mpls(flow, mpls->ethertype, wc);

I think it's a little more subtle than this: we want to drop the
packet, like this, if the label stack is deeper than userspace can
handle, but if it's only deeper than the kernel can handle we want to
just mark the flow as needing userspace help but otherwise continue
processing.

So I changed the commit to the following instead:

--8<--------------------------cut here-------------------------->8--

From: Simon Horman <horms at verge.net.au>
Date: Mon, 3 Feb 2014 11:09:45 -0800
Subject: [PATCH] ofproto-dpif-xlate: Do not push LSE to flow if its label
 stack is full

If a pop is composed on a flow whose label stack is already full
it should not call flow_push_mpls() as that function can't do
anything useful (it aborts) given that the label stack is full.

Signed-off-by: Simon Horman <horms at verge.net.au>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ofproto/ofproto-dpif-xlate.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 3ae6a29..b1d9d0c 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2128,6 +2128,17 @@ compose_mpls_push_action(struct xlate_ctx *ctx, struct ofpact_push_mpls *mpls)
         ctx->xout->slow |= commit_odp_actions(flow, &ctx->base_flow,
                                               &ctx->xout->odp_actions,
                                               &ctx->xout->wc);
+    } else if (n >= ARRAY_SIZE(flow->mpls_lse)) {
+        if (ctx->xin->packet != NULL) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+            VLOG_WARN_RL(&rl, "bridge %s: dropping packet on which an "
+                         "MPLS push action can't be performed as it would "
+                         "have more MPLS LSEs than the %"PRIuSIZE" "
+                         "that can be handled.", ctx->xbridge->name,
+                         ARRAY_SIZE(flow->mpls_lse));
+        }
+        ctx->exit = true;
+        return;
     } else if (n >= ctx->xbridge->max_mpls_depth) {
         COVERAGE_INC(xlate_actions_mpls_overflow);
         ctx->xout->slow |= SLOW_ACTION;
-- 
1.7.10.4




More information about the dev mailing list