summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/lisp-cp/control.c1
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe.h2
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c25
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h5
4 files changed, 29 insertions, 4 deletions
diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c
index 47badeb9163..3fda6ac250a 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/vnet/lisp-cp/control.c
@@ -489,6 +489,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index)
gid_address_copy (&a->rmt_eid, rmt_eid);
a->vni = gid_address_vni (&a->rmt_eid);
+ a->is_src_dst = is_src_dst;
/* get vrf or bd_index associated to vni */
type = gid_address_type (&a->rmt_eid);
diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/vnet/lisp-gpe/lisp_gpe.h
index be447024cb9..e1e5620fc9d 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.h
+++ b/src/vnet/lisp-gpe/lisp_gpe.h
@@ -226,6 +226,8 @@ typedef enum
/** */
typedef struct
{
+ u8 is_src_dst;
+
u8 is_add;
/** type of mapping */
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index f458a14c86b..6e6885af440 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -284,6 +284,14 @@ 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;
+ }
+
dproto = (ip_prefix_version (&lfe->key->rmt.ippref) == IP4 ?
DPO_PROTO_IP4 : DPO_PROTO_IP6);
@@ -324,9 +332,18 @@ create_fib_entries (lisp_gpe_fwd_entry_t * lfe)
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);
}
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h
index 618f7b5393d..92e18526604 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h
@@ -75,6 +75,11 @@ typedef struct lisp_gpe_fwd_entry_key_t_
typedef struct lisp_gpe_fwd_entry_t_
{
/**
+ * Follows src/dst or dst only forwarding policy
+ */
+ u8 is_src_dst;
+
+ /**
* This object joins the FIB control plane graph to receive updates to
* for changes to the graph.
*/