summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@yandex-team.ru>2021-09-18 17:32:17 +0500
committerNeale Ranns <neale@graphiant.com>2021-09-27 11:13:13 +0000
commitc022b2fe399809eda173a748ca050ffc34c18025 (patch)
tree7d86500812e8571c9847115eea3d8c6ed304f43e /src/plugins
parented40167e2b21e52d4177b4ae62fff1b7d8784e1a (diff)
fib: fix crash on exporter tracker remove
Exported entries are tracked only when the prefix found in the export FIB is really attached, exporter tracker is not set if the export entry is not valid for export, ex. for special FIB entries - default route, zeronet, mcast and broadcast prefixes. When imported entries need to be purged, such unset exporter tracker is being removed by non-initialized index with absent delegate entries, causing corresponding assert and crash. Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Ib24a2e7853a03a960577872480213e1e8097da5a
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/unittest/fib_test.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c
index f62f232580d..f5ee4ae69e5 100644
--- a/src/plugins/unittest/fib_test.c
+++ b/src/plugins/unittest/fib_test.c
@@ -5310,7 +5310,7 @@ fib_test_ae (void)
{
const dpo_id_t *dpo, *dpo_drop;
const u32 fib_index = 0;
- fib_node_index_t fei;
+ fib_node_index_t dfrt, fei;
test_main_t *tm;
ip4_main_t *im;
int res;
@@ -5410,6 +5410,44 @@ fib_test_ae (void)
import_fib_index1 = fib_table_find_or_create_and_lock(FIB_PROTOCOL_IP4,
11,
FIB_SOURCE_CLI);
+ /*
+ * Add default route in the import FIB
+ */
+ fib_prefix_t pfx_0_0_0_0_s_0 = {
+ .fp_len = 0,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4 = {
+ {0}
+ },
+ },
+ };
+
+ dfrt = fib_table_lookup(import_fib_index1, &pfx_0_0_0_0_s_0);
+ FIB_TEST((FIB_NODE_INDEX_INVALID != dfrt), "default route present");
+
+ fib_table_entry_path_add(import_fib_index1,
+ &pfx_0_0_0_0_s_0,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ NULL,
+ tm->hw[0]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
+ fei = fib_table_lookup(fib_index, &pfx_0_0_0_0_s_0);
+ FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "default route present");
+ FIB_TEST((fei != dfrt), "default route added");
+
+ /*
+ * delete default route and check for the presence in the import table
+ */
+ fib_table_entry_delete(import_fib_index1, &pfx_0_0_0_0_s_0, FIB_SOURCE_API);
+ fei = fib_table_lookup(import_fib_index1, &pfx_0_0_0_0_s_0);
+ FIB_TEST((FIB_NODE_INDEX_INVALID != fei), "default route present");
+ FIB_TEST((fei == dfrt), "default route removed");
/*
* Add an attached route in the import FIB