for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
bnc = bgp_nexthop_get_node_info(rn);
if (bnc != NULL) {
+ while (!LIST_EMPTY(&(bnc->paths))) {
+ struct bgp_path_info *path =
+ LIST_FIRST(&(bnc->paths));
+
+ path_nh_map(path, bnc, false);
+ }
+
bnc_free(bnc);
bgp_nexthop_set_node_info(rn, NULL);
bgp_unlock_node(rn);
int is_bgp_static_route);
static void evaluate_paths(struct bgp_nexthop_cache *bnc);
static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p);
-static void path_nh_map(struct bgp_path_info *path,
- struct bgp_nexthop_cache *bnc, int keep);
static int bgp_isvalid_nexthop(struct bgp_nexthop_cache *bnc)
{
if (!bnc)
return;
- path_nh_map(path, NULL, 0);
+ path_nh_map(path, NULL, false);
bgp_unlink_nexthop_check(bnc);
}
*/
bgp_unlink_nexthop(pi);
- path_nh_map(pi, bnc, 1); /* updates NHT pi list reference */
+ /* updates NHT pi list reference */
+ path_nh_map(pi, bnc, true);
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) && bnc->metric)
(bgp_path_info_extra_get(pi))->igpmetric = bnc->metric;
* make - if set, make the association. if unset, just break the existing
* association.
*/
-static void path_nh_map(struct bgp_path_info *path,
- struct bgp_nexthop_cache *bnc, int make)
+void path_nh_map(struct bgp_path_info *path, struct bgp_nexthop_cache *bnc,
+ bool make)
{
if (path->nexthop) {
LIST_REMOVE(path, nh_thread);
*/
extern void bgp_cleanup_nexthops(struct bgp *bgp);
+/*
+ * Add or remove the tracking of the bgp_path_info that
+ * uses this nexthop
+ */
+extern void path_nh_map(struct bgp_path_info *path,
+ struct bgp_nexthop_cache *bnc, bool make);
+
#endif /* _BGP_NHT_H */