]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix crash in 'show ip bgp nexthop'
authorPaul Jakma <paul.jakma@hpe.com>
Tue, 6 Sep 2016 10:20:27 +0000 (11:20 +0100)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 18 Oct 2016 12:39:23 +0000 (08:39 -0400)
* 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.

bgpd/bgp_nexthop.c

index 0d6203b2a7ff3595baeba086f1da4cde68d8ad4e..6c30fefae543f66055fdde0ba383333648bf5ab4 100644 (file)
@@ -388,6 +388,9 @@ bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
   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)