bgpd: Fix crash in 'show ip bgp nexthop'
* bgp_nexthop.c: (show_ip_bgp_nexthop_table) the AFIs are sparse, and start
from 1, check there's a table before derefing so as not to crash.
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 429c638..bb3db9f 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -421,6 +421,9 @@
vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
{
+ if (!bgp_nexthop_cache_table[afi])
+ continue;
+
for (rn = bgp_table_top (bgp_nexthop_cache_table[afi]); rn; rn = bgp_route_next (rn))
{
if ((bnc = rn->info) != NULL)