aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2023-09-13 17:21:04 +0200
committerNeale Ranns <neale@graphiant.com>2024-07-12 03:05:02 +0000
commitcaaa63322307b28bc8cf9796f642d9a068722ba5 (patch)
treec2cf4ab158686e79f1b40a09b164ccab1e2b503b
parent63bdb319639e84a50fed0ae91f7508e95af1220e (diff)
fib: log an error when destroying non-empty tables
Destroying a non-empty fib table can lead to difficult to diagnose bugs, like dandling fib entries preventing entries to be inserting to the mtrie. Always log an error to help diagnose those issues. Type: improvement Change-Id: I2c771a80595035b440931b74cca4429af22161a2 Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/fib/fib_entry.c12
-rw-r--r--src/vnet/fib/fib_table.h2
-rw-r--r--src/vnet/fib/ip4_fib.c5
-rw-r--r--src/vnet/fib/ip6_fib.c5
4 files changed, 12 insertions, 12 deletions
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index b78346ce45a..adf880b8bbb 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -1828,10 +1828,18 @@ fib_entry_pool_size (void)
return (pool_elts(fib_entry_pool));
}
-#if CLIB_DEBUG > 0
void
fib_table_assert_empty (const fib_table_t *fib_table)
{
+ if (0 == fib_table->ft_total_route_counts)
+ return;
+
+ vlib_log_err (fib_entry_logger,
+ "BUG: %U table %d (index %d) is not empty",
+ format_fib_protocol, fib_table->ft_proto,
+ fib_table->ft_table_id, fib_table->ft_index);
+
+#if CLIB_DEBUG > 0
fib_node_index_t *fei, *feis = NULL;
fib_entry_t *fib_entry;
@@ -1848,8 +1856,8 @@ fib_table_assert_empty (const fib_table_t *fib_table)
}
ASSERT(0);
-}
#endif
+}
static clib_error_t *
show_fib_entry_command (vlib_main_t * vm,
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index 0eaaa67eea2..d78c9e619b8 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -980,9 +980,7 @@ extern u8 *format_fib_table_memory(u8 *s, va_list *args);
/**
* Debug function
*/
-#if CLIB_DEBUG > 0
extern void fib_table_assert_empty(const fib_table_t *fib_table);
-#endif
#endif
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index 0eff8d0d485..23f70a770bf 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -201,10 +201,7 @@ ip4_fib_table_destroy (u32 fib_index)
/*
* validate no more routes.
*/
-#if CLIB_DEBUG > 0
- if (0 != fib_table->ft_total_route_counts)
- fib_table_assert_empty(fib_table);
-#endif
+ fib_table_assert_empty(fib_table);
vec_foreach(n_locks, fib_table->ft_src_route_counts)
{
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index d37b77e08a4..ccf8e22f5a7 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -160,10 +160,7 @@ ip6_fib_table_destroy (u32 fib_index)
/*
* validate no more routes.
*/
-#if CLIB_DEBUG > 0
- if (0 != fib_table->ft_total_route_counts)
- fib_table_assert_empty(fib_table);
-#endif
+ fib_table_assert_empty(fib_table);
vec_foreach_index(source, fib_table->ft_src_route_counts)
{