aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/unittest
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-08-20 15:53:43 +0200
committerNeale Ranns <neale@graphiant.com>2021-11-23 09:03:30 +0000
commita424dd1b2e345bd8ebc5088fcd42d721a2ac00d7 (patch)
tree193a6e5bfd939d217151385bf3061e06867d200c /src/plugins/unittest
parentb19d3e3e038ba8762953a68e046f11674ad583b0 (diff)
ip: unlock_fib on if delete
On interface delete we were not removing the lock taken by a previous ip_table_bind() call thus preventing the VRFs to be removed. Type: fix Change-Id: I11abbb51a09b45cd3390b23d5d601d029c5ea485 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/unittest')
-rw-r--r--src/plugins/unittest/fib_test.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c
index 26e2d247666..3166e649bfe 100644
--- a/src/plugins/unittest/fib_test.c
+++ b/src/plugins/unittest/fib_test.c
@@ -158,8 +158,6 @@ fib_test_mk_intf (u32 ninterfaces)
VNET_HW_INTERFACE_FLAG_LINK_UP);
tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
tm->hw_if_indicies[i]);
- ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
- ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
error = vnet_sw_interface_set_flags(vnet_get_main(),
tm->hw[i]->sw_if_index,
@@ -822,9 +820,7 @@ fib_test_v4 (void)
FIB_SOURCE_API);
for (ii = 0; ii < 4; ii++)
- {
- ip4_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
- }
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[ii]->sw_if_index, fib_index);
fib_prefix_t pfx_0_0_0_0_s_0 = {
.fp_len = 0,
@@ -4393,6 +4389,9 @@ fib_test_v4 (void)
FIB_SOURCE_INTERFACE)),
"NO INterface Source'd prefixes");
+ for (ii = 0; ii < 4; ii++)
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[ii]->sw_if_index, 0);
+
fib_table_unlock(fib_index, FIB_PROTOCOL_IP4, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
@@ -4451,9 +4450,7 @@ fib_test_v6 (void)
FIB_SOURCE_API);
for (ii = 0; ii < 4; ii++)
- {
- ip6_main.fib_index_by_sw_if_index[tm->hw[ii]->sw_if_index] = fib_index;
- }
+ fib_table_bind (FIB_PROTOCOL_IP6, tm->hw[ii]->sw_if_index, fib_index);
fib_prefix_t pfx_0_0 = {
.fp_len = 0,
@@ -5272,6 +5269,10 @@ fib_test_v6 (void)
/*
* now remove the VRF
*/
+
+ for (ii = 0; ii < 4; ii++)
+ fib_table_bind (FIB_PROTOCOL_IP6, tm->hw[ii]->sw_if_index, 0);
+
fib_table_unlock(fib_index, FIB_PROTOCOL_IP6, FIB_SOURCE_API);
FIB_TEST((0 == fib_path_list_db_size()), "path list DB population:%d",
@@ -5312,12 +5313,10 @@ fib_test_ae (void)
const u32 fib_index = 0;
fib_node_index_t dfrt, fei;
test_main_t *tm;
- ip4_main_t *im;
int res;
res = 0;
tm = &test_main;
- im = &ip4_main;
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
adj_nbr_db_size());
@@ -5337,7 +5336,7 @@ fib_test_ae (void)
},
};
- im->fib_index_by_sw_if_index[tm->hw[0]->sw_if_index] = fib_index;
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[0]->sw_if_index, fib_index);
dpo_drop = drop_dpo_get(DPO_PROTO_IP4);
@@ -5904,11 +5903,9 @@ static int
fib_test_pref (void)
{
test_main_t *tm;
- ip4_main_t *im;
int res, i;
tm = &test_main;
- im = &ip4_main;
res = 0;
const fib_prefix_t pfx_1_1_1_1_s_32 = {
@@ -5922,7 +5919,7 @@ fib_test_pref (void)
};
for (i = 0; i <= 2; i++)
- im->fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[i]->sw_if_index, 0);
/*
* 2 high, 2 medium and 2 low preference non-recursive paths
@@ -6371,12 +6368,10 @@ fib_test_label (void)
const u32 fib_index = 0;
int lb_count, ii, res;
test_main_t *tm;
- ip4_main_t *im;
res = 0;
lb_count = pool_elts(load_balance_pool);
tm = &test_main;
- im = &ip4_main;
/*
* add interface routes. We'll assume this works. It's more rigorously
@@ -6396,7 +6391,7 @@ fib_test_label (void)
FIB_TEST((0 == adj_nbr_db_size()), "ADJ DB size is %d",
adj_nbr_db_size());
- im->fib_index_by_sw_if_index[tm->hw[0]->sw_if_index] = fib_index;
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[0]->sw_if_index, fib_index);
fib_table_entry_update_one_path(fib_index, &local0_pfx,
FIB_SOURCE_INTERFACE,
@@ -6441,7 +6436,7 @@ fib_test_label (void)
},
};
- im->fib_index_by_sw_if_index[tm->hw[1]->sw_if_index] = fib_index;
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[1]->sw_if_index, fib_index);
fib_table_entry_update_one_path(fib_index, &local1_pfx,
FIB_SOURCE_INTERFACE,
@@ -9157,19 +9152,15 @@ fib_test_inherit (void)
fib_node_index_t fei;
int n_feis, res, i;
test_main_t *tm;
- ip4_main_t *im4;
- ip6_main_t *im6;
tm = &test_main;
- im4 = &ip4_main;
- im6 = &ip6_main;
res = 0;
for (i = 0; i <= 2; i++)
- {
- im4->fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
- im6->fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
- }
+ {
+ fib_table_bind (FIB_PROTOCOL_IP4, tm->hw[i]->sw_if_index, 0);
+ fib_table_bind (FIB_PROTOCOL_IP6, tm->hw[i]->sw_if_index, 0);
+ }
n_feis = fib_entry_pool_size();
const ip46_address_t nh_10_10_10_1 = {