fib: fix debug preprocessor directives
Type: fix
Some debugging declarations were wrapped in an 'ifdef CLIB_DEBUG'.
This seems to always evaluate true because clib.h defines CLIB_DEBUG
to 0 if its not defined.
The result is that if a route table is added and a route is added to
it and then the table is deleted, VPP exits because the debug function
fib_table_assert_empty() gets called whether VPP was started using a
debug build or a release build.
Change the ifdef to 'if CLIB_DEBUG > 0'.
Change-Id: I357dc2c299e81b95244f2f7efaadb8e0de27627a
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index 3bef28e..a8dec1a 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -1713,7 +1713,7 @@
return (pool_elts(fib_entry_pool));
}
-#ifdef CLIB_DEBUG
+#if CLIB_DEBUG > 0
void
fib_table_assert_empty (const fib_table_t *fib_table)
{
diff --git a/src/vnet/fib/fib_table.h b/src/vnet/fib/fib_table.h
index 7f18188..2011707 100644
--- a/src/vnet/fib/fib_table.h
+++ b/src/vnet/fib/fib_table.h
@@ -960,7 +960,7 @@
/**
* Debug function
*/
-#ifdef CLIB_DEBUG
+#if CLIB_DEBUG > 0
extern void fib_table_assert_empty(const fib_table_t *fib_table);
#endif
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index 29d121c..5b12aa6 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -182,7 +182,7 @@
/*
* validate no more routes.
*/
-#ifdef CLIB_DEBUG
+#if CLIB_DEBUG > 0
if (0 != fib_table->ft_total_route_counts)
fib_table_assert_empty(fib_table);
#endif
diff --git a/src/vnet/fib/ip6_fib.c b/src/vnet/fib/ip6_fib.c
index 784f52c..5664173 100644
--- a/src/vnet/fib/ip6_fib.c
+++ b/src/vnet/fib/ip6_fib.c
@@ -154,7 +154,7 @@
/*
* validate no more routes.
*/
-#ifdef CLIB_DEBUG
+#if CLIB_DEBUG > 0
if (0 != fib_table->ft_total_route_counts)
fib_table_assert_empty(fib_table);
#endif