X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Flisp-gpe%2Flisp_gpe_fwd_entry.c;h=d2954e9649aa840a8f205ec0014fdd8fbca3245f;hb=0f26c5a0138ac86d7ebd197c31a09d8d624c35fe;hp=f458a14c86b660435a467aeceb5c3acaa95fb9ff;hpb=4868ff65eddfd694a1485d6c6c355f9a8ca9011d;p=vpp.git diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c index f458a14c86b..d2954e9649a 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c +++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c @@ -88,6 +88,7 @@ ip_dst_fib_add_route (u32 dst_fib_index, const ip_prefix_t * dst_prefix) (ip_prefix_version (dst_prefix) == IP6 ? DPO_PROTO_IP6 : DPO_PROTO_IP4), + LOOKUP_UNICAST, LOOKUP_INPUT_SRC_ADDR, LOOKUP_TABLE_FROM_CONFIG, &src_lkup_dpo); @@ -283,12 +284,21 @@ static void create_fib_entries (lisp_gpe_fwd_entry_t * lfe) { dpo_proto_t dproto; - + 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) { @@ -310,23 +320,30 @@ 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); } } static void delete_fib_entries (lisp_gpe_fwd_entry_t * lfe) { - ip_src_dst_fib_del_route (lfe->src_fib_index, - &lfe->key->lcl.ippref, - lfe->eid_fib_index, &lfe->key->rmt.ippref); + fib_prefix_t dst_fib_prefix; + + if (lfe->is_src_dst) + ip_src_dst_fib_del_route (lfe->src_fib_index, + &lfe->key->lcl.ippref, + lfe->eid_fib_index, &lfe->key->rmt.ippref); + else + { + ip_prefix_to_fib_prefix (&lfe->key->rmt.ippref, &dst_fib_prefix); + fib_table_entry_delete (lfe->src_fib_index, &dst_fib_prefix, + FIB_SOURCE_LISP); + } } static lisp_gpe_fwd_entry_t * @@ -435,6 +452,7 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm, lfe->eid_table_id = a->table_id; lfe->eid_fib_index = fib_table_find_or_create_and_lock (fproto, lfe->eid_table_id); + lfe->is_src_dst = a->is_src_dst; if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type) { @@ -442,7 +460,6 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm, } create_fib_entries (lfe); - return (0); }