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.
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 145a1d8..607d99b 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -496,7 +496,8 @@
afi, SAFI_UNICAST);
}
}
- bgp_process (bgp, rn, afi, SAFI_UNICAST);
+ if (rn->info)
+ bgp_process (bgp, rn, afi, SAFI_UNICAST);
}
/* Flash old cache. */
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 316fa5a..e0e14ec 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1336,7 +1336,18 @@
struct bgp_info *nextri = NULL;
int paths_eq, do_mpath;
struct list mp_list;
-
+
+ result->old = result->new = NULL;
+
+ if (rn->info == NULL)
+ {
+ char buf[PREFIX_STRLEN];
+ 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 != BGP_DEFAULT_MAXPATHS ||
mpath_cfg->maxpaths_ibgp != BGP_DEFAULT_MAXPATHS);
@@ -1455,7 +1466,6 @@
if (do_mpath && paths_eq)
bgp_mp_list_add (&mp_list, ri);
}
-
if (!bgp_flag_check (bgp, BGP_FLAG_DETERMINISTIC_MED))
bgp_info_mpath_update (rn, new_select, old_select, &mp_list, mpath_cfg);
@@ -1712,6 +1722,19 @@
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[PREFIX_STRLEN];
+ 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) ||
(bm->process_rsclient_queue == NULL) )
bgp_process_queue_init ();