aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-05-30 10:39:20 +0200
committerFlorin Coras <florin.coras@gmail.com>2016-05-31 11:19:39 +0000
commitd1c5cc3930277d6a09dbe80b5d1fcb636ce060d2 (patch)
tree2108caf219a789b5a86f59289711ac80b982620f
parent0e06e2b1420bca9b2bddd43e9642e56c81768fc2 (diff)
ONE-16: Locators are not properly cleaned
Change-Id: Ia6eaaa9a741e84cbd0ff957cfd9a7143a3d0a977 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--vnet/vnet/lisp-cp/control.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index 419b745a2e4..2a29bd21d34 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -744,7 +744,7 @@ VLIB_CLI_COMMAND (lisp_cp_show_local_eid_table_command) = {
static void
clean_locator_to_locator_set (lisp_cp_main_t * lcm, u32 lsi)
{
- u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes;
+ u32 i, j, *loc_indexp, *ls_indexp, **ls_indexes, *to_be_deleted = 0;
locator_set_t * ls = pool_elt_at_index(lcm->locator_set_pool, lsi);
for (i = 0; i < vec_len(ls->locator_indices); i++)
{
@@ -763,9 +763,23 @@ clean_locator_to_locator_set (lisp_cp_main_t * lcm, u32 lsi)
/* delete locator if it's part of no locator-set */
if (vec_len (ls_indexes[0]) == 0)
- pool_put_index(lcm->locator_pool, loc_indexp[0]);
+ {
+ pool_put_index (lcm->locator_pool, loc_indexp[0]);
+ vec_add1 (to_be_deleted, i);
+ }
+ }
+
+ if (to_be_deleted)
+ {
+ for (i = 0; i < vec_len (to_be_deleted); i++)
+ {
+ loc_indexp = vec_elt_at_index (to_be_deleted, i);
+ vec_del1 (ls->locator_indices, loc_indexp[0]);
+ }
+ vec_free (to_be_deleted);
}
}
+
int
vnet_lisp_add_del_locator_set (vnet_lisp_add_del_locator_set_args_t * a,
u32 * ls_result)