From ff75b6c05bb9ca1b9c4c48f2231fd4cbfd393b17 Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Tue, 1 Dec 2015 14:32:11 +0000 Subject: [PATCH] bgpd: bgp_scan shouldn't queue up route_nodes with no routes for processing * bgp_nexthop.c: (bgp_scan) There is little point queueing an rn with no routing information for processing. * bgp_route.c: (bgp_process) Do nothing on rn's with no routes. Add an assert for now, to try catch any other cases, but prob should be removed. (bgp_best_selection) rn with no routes == finish early. (cherry picked from commit 91b9e8547a7c5697d5d7481f9476778077024019) Conflicts: bgpd/bgp_nexthop.c bgpd/bgp_route.c --- bgpd/bgp_route.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f04d6db53b..adc6407bb9 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1520,6 +1520,17 @@ bgp_best_selection (struct bgp *bgp, struct bgp_node *rn, char pfx_buf[PREFIX2STR_BUFFER]; char path_buf[PATH_ADDPATH_STR_BUFFER]; + result->old = result->new = NULL; + + if (rn->info == NULL) + { + char buf[PREFIX2STR_BUFFER]; + zlog_warn ("%s: Called for route_node %s with no routing entries!", + __func__, + prefix2str (&(bgp_node_to_rnode (rn)->p), buf, sizeof(buf))); + return; + } + bgp_mp_list_init (&mp_list); do_mpath = (mpath_cfg->maxpaths_ebgp > 1 || mpath_cfg->maxpaths_ibgp > 1); @@ -1908,6 +1919,19 @@ bgp_process (struct bgp *bgp, struct bgp_node *rn, afi_t afi, safi_t safi) if (CHECK_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED)) return; + if (rn->info == NULL) + { + /* XXX: Perhaps remove before next release, after we've flushed out + * any obvious cases + */ + assert (rn->info != NULL); + char buf[PREFIX2STR_BUFFER]; + zlog_warn ("%s: Called for route_node %s with no routing entries!", + __func__, + prefix2str (&(bgp_node_to_rnode (rn)->p), buf, sizeof(buf))); + return; + } + if (bm->process_main_queue == NULL) bgp_process_queue_init (); -- 2.39.5