summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-12-06 00:45:33 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-06 19:40:06 +0000
commitf363ebd4e7cd60dada11daa0e61b64569a9e1cf6 (patch)
treef197d40542c46e7b4741d7d8fbfea3934c69ad72 /src/vnet/dpo
parent73e4f7965b7f6c0ff3c1217962f76ad586af6332 (diff)
Label stack size exceeded fix
Change-Id: Ibe2041d83e9b5be16801dc316bd472ae4f6e8c31 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/dpo')
-rw-r--r--src/vnet/dpo/mpls_label_dpo.c12
-rw-r--r--src/vnet/dpo/mpls_label_dpo.h8
2 files changed, 19 insertions, 1 deletions
diff --git a/src/vnet/dpo/mpls_label_dpo.c b/src/vnet/dpo/mpls_label_dpo.c
index c6e8dcc475c..fa5177ab9ea 100644
--- a/src/vnet/dpo/mpls_label_dpo.c
+++ b/src/vnet/dpo/mpls_label_dpo.c
@@ -16,6 +16,7 @@
#include <vnet/ip/ip.h>
#include <vnet/dpo/mpls_label_dpo.h>
#include <vnet/mpls/mpls.h>
+#include <vnet/dpo/drop_dpo.h>
/*
* pool of all MPLS Label DPOs
@@ -53,6 +54,17 @@ mpls_label_dpo_create (mpls_label_t *label_stack,
u32 ii;
mld = mpls_label_dpo_alloc();
+
+ if (MPLS_LABEL_DPO_MAX_N_LABELS < vec_len(label_stack))
+ {
+ clib_warning("Label stack size exceeded");
+ dpo_stack(DPO_MPLS_LABEL,
+ mld->mld_payload_proto,
+ &mld->mld_dpo,
+ drop_dpo_get(DPO_PROTO_MPLS));
+ return (mpls_label_dpo_get_index(mld));
+ }
+
mld->mld_n_labels = vec_len(label_stack);
mld->mld_n_hdr_bytes = mld->mld_n_labels * sizeof(mld->mld_hdr[0]);
mld->mld_payload_proto = payload_proto;
diff --git a/src/vnet/dpo/mpls_label_dpo.h b/src/vnet/dpo/mpls_label_dpo.h
index e23f3d262ff..8494d26b495 100644
--- a/src/vnet/dpo/mpls_label_dpo.h
+++ b/src/vnet/dpo/mpls_label_dpo.h
@@ -20,6 +20,11 @@
#include <vnet/mpls/packet.h>
#include <vnet/dpo/dpo.h>
+
+/**
+ * Maximum number of labels in one DPO
+ */
+#define MPLS_LABEL_DPO_MAX_N_LABELS 12
/**
* A representation of an MPLS label for imposition in the data-path
*/
@@ -27,8 +32,9 @@ typedef struct mpls_label_dpo_t
{
/**
* The MPLS label header to impose. Outer most label first.
+ * Each DPO will occupy one cache line, stuff that many labels in.
*/
- mpls_unicast_header_t mld_hdr[8];
+ mpls_unicast_header_t mld_hdr[MPLS_LABEL_DPO_MAX_N_LABELS];
/**
* Next DPO in the graph
ight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# Copyright (c) 2016 Cisco Systems, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

vppplugins_LTLIBRARIES += gbp_plugin.la

gbp_plugin_la_SOURCES = 		\
	gbp/gbp_subnet.c		\
	gbp/gbp_contract.c		\
	gbp/gbp_endpoint.c		\
	gbp/gbp_endpoint_group.c	\
	gbp/gbp_classify.c  		\
	gbp/gbp_recirc.c  		\
	gbp/gbp_policy.c		\
	gbp/gbp_policy_dpo.c		\
	gbp/gbp_fwd.c			\
	gbp/gbp_fwd_dpo.c		\
	gbp/gbp_api.c

API_FILES += gbp/gbp.api

noinst_HEADERS += 		\
	gbp/gbp.h		\
	gbp/gbp_all_api_h.h	\
	gbp/gbp_msg_enum.h	\
	gbp/gbp.api.h

# vi:syntax=automake