aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-gpe
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-09-10 04:39:11 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-09-11 10:14:36 +0000
commit1500254bee11355bbd69cc1dd9705be4f002f2bd (patch)
treec403642105f399baccb3a727020232b5732fe8f7 /src/vnet/lisp-gpe
parenta7191840beeb2c3a0f2598707ed1051a9f23c45f (diff)
FIB table add/delete API
part 2; - this adds the code to create an IP and MPLS table via the API. - but the enforcement that the table must be created before it is used is still missing, this is so that CSIT can pass. Change-Id: Id124d884ade6cb7da947225200e3bb193454c555 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/lisp-gpe')
-rw-r--r--src/vnet/lisp-gpe/interface.c11
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c9
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_sub_interface.c11
3 files changed, 22 insertions, 9 deletions
diff --git a/src/vnet/lisp-gpe/interface.c b/src/vnet/lisp-gpe/interface.c
index e832c23fd8e..a0c05e85682 100644
--- a/src/vnet/lisp-gpe/interface.c
+++ b/src/vnet/lisp-gpe/interface.c
@@ -505,12 +505,14 @@ lisp_gpe_iface_set_table (u32 sw_if_index, u32 table_id)
{
fib_node_index_t fib_index;
- fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, table_id);
+ fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, table_id,
+ FIB_SOURCE_LISP);
vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index);
ip4_main.fib_index_by_sw_if_index[sw_if_index] = fib_index;
ip4_sw_interface_enable_disable (sw_if_index, 1);
- fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id);
+ fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id,
+ FIB_SOURCE_LISP);
vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index);
ip6_main.fib_index_by_sw_if_index[sw_if_index] = fib_index;
ip6_sw_interface_enable_disable (sw_if_index, 1);
@@ -530,7 +532,7 @@ lisp_gpe_tenant_del_default_routes (u32 table_id)
fib_index = fib_table_find (prefix.fp_proto, table_id);
fib_table_entry_special_remove (fib_index, &prefix, FIB_SOURCE_LISP);
- fib_table_unlock (fib_index, prefix.fp_proto);
+ fib_table_unlock (fib_index, prefix.fp_proto, FIB_SOURCE_LISP);
}
}
@@ -549,7 +551,8 @@ lisp_gpe_tenant_add_default_routes (u32 table_id)
/*
* Add a deafult route that results in a control plane punt DPO
*/
- fib_index = fib_table_find_or_create_and_lock (prefix.fp_proto, table_id);
+ fib_index = fib_table_find_or_create_and_lock (prefix.fp_proto, table_id,
+ FIB_SOURCE_LISP);
fib_table_entry_special_dpo_add (fib_index, &prefix, FIB_SOURCE_LISP,
FIB_ENTRY_FLAG_EXCLUSIVE,
lisp_cp_dpo_get (fib_proto_to_dpo
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
index d7d3cb8652f..0a8dc039909 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -66,6 +66,7 @@ ip_dst_fib_add_route (u32 dst_fib_index, const ip_prefix_t * dst_prefix)
/* create a new src FIB. */
src_fib_index =
fib_table_create_and_lock (dst_fib_prefix.fp_proto,
+ FIB_SOURCE_LISP,
"LISP-src for [%d,%U]",
dst_fib_index,
format_fib_prefix, &dst_fib_prefix);
@@ -180,7 +181,8 @@ ip_src_dst_fib_del_route (u32 src_fib_index,
*/
fib_table_entry_special_remove (dst_fib_index,
&dst_fib_prefix, FIB_SOURCE_LISP);
- fib_table_unlock (src_fib_index, src_fib_prefix.fp_proto);
+ fib_table_unlock (src_fib_index, src_fib_prefix.fp_proto,
+ FIB_SOURCE_LISP);
}
}
@@ -544,7 +546,8 @@ add_ip_fwd_entry (lisp_gpe_main_t * lgm,
lfe->tenant = lisp_gpe_tenant_find_or_create (lfe->key->vni);
lfe->eid_table_id = a->table_id;
lfe->eid_fib_index = fib_table_find_or_create_and_lock (fproto,
- lfe->eid_table_id);
+ lfe->eid_table_id,
+ FIB_SOURCE_LISP);
lfe->is_src_dst = a->is_src_dst;
if (LISP_GPE_FWD_ENTRY_TYPE_NEGATIVE != lfe->type)
@@ -578,7 +581,7 @@ del_ip_fwd_entry_i (lisp_gpe_main_t * lgm, lisp_gpe_fwd_entry_t * lfe)
fproto = (IP4 == ip_prefix_version (&fid_addr_ippref (&lfe->key->rmt)) ?
FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
- fib_table_unlock (lfe->eid_fib_index, fproto);
+ fib_table_unlock (lfe->eid_fib_index, fproto, FIB_SOURCE_LISP);
hash_unset_mem (lgm->lisp_gpe_fwd_entries, lfe->key);
clib_mem_free (lfe->key);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
index b234d9dc581..26664f53104 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
@@ -89,13 +89,15 @@ lisp_gpe_sub_interface_set_table (u32 sw_if_index, u32 table_id)
{
fib_node_index_t fib_index;
- fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, table_id);
+ fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP4, table_id,
+ FIB_SOURCE_LISP);
ASSERT (FIB_NODE_INDEX_INVALID != fib_index);
vec_validate (ip4_main.fib_index_by_sw_if_index, sw_if_index);
ip4_main.fib_index_by_sw_if_index[sw_if_index] = fib_index;
- fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id);
+ fib_index = fib_table_find_or_create_and_lock (FIB_PROTOCOL_IP6, table_id,
+ FIB_SOURCE_LISP);
ASSERT (FIB_NODE_INDEX_INVALID != fib_index);
vec_validate (ip6_main.fib_index_by_sw_if_index, sw_if_index);
@@ -105,9 +107,13 @@ lisp_gpe_sub_interface_set_table (u32 sw_if_index, u32 table_id)
static void
lisp_gpe_sub_interface_unset_table (u32 sw_if_index, u32 table_id)
{
+ fib_table_unlock (ip4_main.fib_index_by_sw_if_index[sw_if_index],
+ FIB_PROTOCOL_IP4, FIB_SOURCE_LISP);
ip4_main.fib_index_by_sw_if_index[sw_if_index] = 0;
ip4_sw_interface_enable_disable (sw_if_index, 0);
+ fib_table_unlock (ip6_main.fib_index_by_sw_if_index[sw_if_index],
+ FIB_PROTOCOL_IP6, FIB_SOURCE_LISP);
ip6_main.fib_index_by_sw_if_index[sw_if_index] = 0;
ip6_sw_interface_enable_disable (sw_if_index, 0);
}
@@ -185,6 +191,7 @@ lisp_gpe_sub_interface_unlock (index_t l3si)
l3s = lisp_gpe_sub_interface_get_i (l3si);
+ ASSERT (0 != l3s->locks);
l3s->locks--;
if (0 == l3s->locks)