summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe/decap.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-02-21 18:28:34 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-02-27 10:20:50 +0000
commit3e7b569361f97368b0cad3468fac76ef2a398bfa (patch)
treec1184cd493b762c5d868857d71fc919bc14ccfce /src/vnet/lisp-gpe/decap.c
parent646ba9b004055861c6dbce14424cb1d3de757ff6 (diff)
Add GPE CLI/API for setting encap mode
Change-Id: Id89e23fb5d275572b2356c073dfa0f55719e1a76 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-gpe/decap.c')
-rw-r--r--src/vnet/lisp-gpe/decap.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vnet/lisp-gpe/decap.c b/src/vnet/lisp-gpe/decap.c
index 5fd449cee9b..9c5234e7182 100644
--- a/src/vnet/lisp-gpe/decap.c
+++ b/src/vnet/lisp-gpe/decap.c
@@ -62,10 +62,17 @@ static u32 next_proto_to_next_index[LISP_GPE_NEXT_PROTOS] = {
always_inline u32
next_protocol_to_next_index (lisp_gpe_header_t * lgh, u8 * next_header)
{
+ lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main ();
+
/* lisp-gpe router */
if (PREDICT_TRUE ((lgh->flags & LISP_GPE_FLAGS_P)
- && lgh->next_protocol < LISP_GPE_NEXT_PROTOS))
- return next_proto_to_next_index[lgh->next_protocol];
+ || GPE_ENCAP_VXLAN == lgm->encap_mode))
+ {
+ if (PREDICT_FALSE (lgh->next_protocol > LISP_GPE_NEXT_PROTOS))
+ return LISP_GPE_INPUT_NEXT_DROP;
+
+ return next_proto_to_next_index[lgh->next_protocol];
+ }
/* legacy lisp router */
else if ((lgh->flags & LISP_GPE_FLAGS_P) == 0)
{