diff options
author | 2023-09-13 17:21:04 +0200 | |
---|---|---|
committer | 2024-07-12 03:05:02 +0000 | |
commit | caaa63322307b28bc8cf9796f642d9a068722ba5 (patch) | |
tree | c2cf4ab158686e79f1b40a09b164ccab1e2b503b /src/vnet/fib/fib_entry.c | |
parent | 63bdb319639e84a50fed0ae91f7508e95af1220e (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>
Diffstat (limited to 'src/vnet/fib/fib_entry.c')
-rw-r--r-- | src/vnet/fib/fib_entry.c | 12 |
1 files changed, 10 insertions, 2 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, |