summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/ip4_fib.c3
-rw-r--r--src/vnet/fib/ip4_fib.h6
2 files changed, 3 insertions, 6 deletions
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index e8211c80d20..a7915620b37 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -158,8 +158,9 @@ ip4_fib_table_destroy (ip4_fib_t *fib)
/*
* remove all the specials we added when the table was created.
+ * In reverse order so the default route is last.
*/
- for (ii = 0; ii < ARRAY_LEN(ip4_specials); ii++)
+ for (ii = ARRAY_LEN(ip4_specials) - 1; ii >= 0; ii--)
{
fib_prefix_t prefix = ip4_specials[ii].ift_prefix;
diff --git a/src/vnet/fib/ip4_fib.h b/src/vnet/fib/ip4_fib.h
index a8dc68b5d5f..243fd77f855 100644
--- a/src/vnet/fib/ip4_fib.h
+++ b/src/vnet/fib/ip4_fib.h
@@ -133,15 +133,11 @@ ip4_fib_forwarding_lookup (u32 fib_index,
mtrie = &ip4_fib_get(fib_index)->mtrie;
- leaf = IP4_FIB_MTRIE_LEAF_ROOT;
- leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 0);
+ leaf = ip4_fib_mtrie_lookup_step_one (mtrie, addr);
leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 1);
leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 2);
leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 3);
- /* Handle default route. */
- leaf = (leaf == IP4_FIB_MTRIE_LEAF_EMPTY ? mtrie->default_leaf : leaf);
-
return (ip4_fib_mtrie_leaf_get_adj_index(leaf));
}