summaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-04-04 15:26:54 +0200
committerFlorin Coras <florin.coras@gmail.com>2017-04-05 06:17:37 +0000
commit517f72fe18c8ea60dc01e12e525bc22bef07f1d2 (patch)
tree77a39593da5111f240d55321dcb1a5478da125dd /src/vnet/lisp-gpe
parent9fc0c26c6b28fd6c8b8142ea52f52eafa7e8c7ac (diff)
LISP: fix crash when adding a negative forwarding entry, VPP-681
Change-Id: I190696da5555c05074ee0eee32eb914bd16e38fb Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/vnet/lisp-gpe')
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index 6e6885af440..efa724e0d5b 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -283,20 +283,21 @@ static void
create_fib_entries (lisp_gpe_fwd_entry_t * lfe)
{
dpo_proto_t dproto;
-
- if (!lfe->is_src_dst)
- {
- /* install normal destination route if not src/dst and be done */
- ip_src_fib_add_route (lfe->eid_fib_index,
- &lfe->key->rmt.ippref, lfe->paths);
- return;
- }
-
+ ip_prefix_t ippref;
dproto = (ip_prefix_version (&lfe->key->rmt.ippref) == IP4 ?
DPO_PROTO_IP4 : DPO_PROTO_IP6);
- lfe->src_fib_index = ip_dst_fib_add_route (lfe->eid_fib_index,
- &lfe->key->rmt.ippref);
+ if (lfe->is_src_dst)
+ {
+ lfe->src_fib_index = ip_dst_fib_add_route (lfe->eid_fib_index,
+ &lfe->key->rmt.ippref);
+ memcpy (&ippref, &lfe->key->lcl.ippref, sizeof (ippref));
+ }
+ else
+ {
+ lfe->src_fib_index = lfe->eid_fib_index;
+ memcpy (&ippref, &lfe->key->rmt.ippref, sizeof (ippref));
+ }
if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE == lfe->type)
{
@@ -318,14 +319,12 @@ create_fib_entries (lisp_gpe_fwd_entry_t * lfe)
dpo_copy (&dpo, drop_dpo_get (dproto));
break;
}
- ip_src_fib_add_route_w_dpo (lfe->src_fib_index,
- &lfe->key->lcl.ippref, &dpo);
+ ip_src_fib_add_route_w_dpo (lfe->src_fib_index, &ippref, &dpo);
dpo_reset (&dpo);
}
else
{
- ip_src_fib_add_route (lfe->src_fib_index,
- &lfe->key->lcl.ippref, lfe->paths);
+ ip_src_fib_add_route (lfe->src_fib_index, &ippref, lfe->paths);
}
}