* Compare and sync up the multipath list with the mp_list generated by
* bgp_best_selection
*/
-void bgp_path_info_mpath_update(struct bgp_dest *dest,
+void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
struct bgp_path_info *new_best,
struct bgp_path_info *old_best,
struct list *mp_list,
if (debug)
zlog_debug(
- "%pRN: starting mpath update, newbest %s num candidates %d old-mpath-count %d old-cum-bw u%" PRIu64,
- bgp_dest_to_rnode(dest),
+ "%pRN(%s): starting mpath update, newbest %s num candidates %d old-mpath-count %d old-cum-bw u%" PRIu64,
+ bgp_dest_to_rnode(dest), bgp->name_pretty,
new_best ? new_best->peer->host : "NONE",
- mp_list ? listcount(mp_list) : 0,
- old_mpath_count, old_cum_bw);
+ mp_list ? listcount(mp_list) : 0, old_mpath_count,
+ old_cum_bw);
/*
* We perform an ordered walk through both lists in parallel.
if (debug)
zlog_debug(
- "%pRN: comparing candidate %s with existing mpath %s",
- bgp_dest_to_rnode(dest),
+ "%pRN(%s): comparing candidate %s with existing mpath %s",
+ bgp_dest_to_rnode(dest), bgp->name_pretty,
tmp_info ? tmp_info->peer->host : "NONE",
cur_mpath ? cur_mpath->peer->host : "NONE");
if (debug)
zlog_debug(
- "%pRN: New mpath count (incl newbest) %d mpath-change %s all_paths_lb %d cum_bw u%" PRIu64,
- bgp_dest_to_rnode(dest), mpath_count,
- mpath_changed ? "YES" : "NO",
+ "%pRN(%s): New mpath count (incl newbest) %d mpath-change %s all_paths_lb %d cum_bw u%" PRIu64,
+ bgp_dest_to_rnode(dest), bgp->name_pretty,
+ mpath_count, mpath_changed ? "YES" : "NO",
all_paths_lb, cum_bw);
if (mpath_changed
if (exist == NULL) {
*reason = bgp_path_selection_first;
if (debug)
- zlog_debug("%s: %s is the initial bestpath", pfx_buf,
- new_buf);
+ zlog_debug("%s(%s): %s is the initial bestpath",
+ pfx_buf, bgp->name_pretty, new_buf);
return 1;
}
if (debug) {
bgp_path_info_path_with_addpath_rx_str(exist, exist_buf,
sizeof(exist_buf));
- zlog_debug("%s: Comparing %s flags 0x%x with %s flags 0x%x",
- pfx_buf, new_buf, new->flags, exist_buf,
- exist->flags);
+ zlog_debug("%s(%s): Comparing %s flags 0x%x with %s flags 0x%x",
+ pfx_buf, bgp->name_pretty, new_buf, new->flags,
+ exist_buf, exist->flags);
}
newattr = new->attr;
bgp_path_info_path_with_addpath_rx_str(
new_select, path_buf, sizeof(path_buf));
zlog_debug(
- "%pBD: %s is the bestpath from AS %u",
- dest, path_buf,
+ "%pBD(%s): %s is the bestpath from AS %u",
+ dest, bgp->name_pretty, path_buf,
aspath_get_first_as(
new_select->attr->aspath));
}
else
snprintf(path_buf, sizeof(path_buf), "NONE");
zlog_debug(
- "%pBD: After path selection, newbest is %s oldbest was %s",
- dest, path_buf,
+ "%pBD(%s): After path selection, newbest is %s oldbest was %s",
+ dest, bgp->name_pretty, path_buf,
old_select ? old_select->peer->host : "NONE");
}
if (pi == new_select) {
if (debug)
zlog_debug(
- "%pBD: %s is the bestpath, add to the multipath list",
- dest, path_buf);
+ "%pBD(%s): %s is the bestpath, add to the multipath list",
+ dest, bgp->name_pretty,
+ path_buf);
bgp_mp_list_add(&mp_list, pi);
continue;
}
}
}
- bgp_path_info_mpath_update(dest, new_select, old_select, &mp_list,
+ bgp_path_info_mpath_update(bgp, dest, new_select, old_select, &mp_list,
mpath_cfg);
bgp_path_info_mpath_aggregate_update(new_select, old_select);
bgp_mp_list_clear(&mp_list);
debug = bgp_debug_bestpath(dest);
if (debug)
- zlog_debug("%s: p=%pBD afi=%s, safi=%s start", __func__, dest,
- afi2str(afi), safi2str(safi));
+ zlog_debug("%s: p=%pBDi(%s) afi=%s, safi=%s start", __func__,
+ dest, bgp->name_pretty, afi2str(afi),
+ safi2str(safi));
/* The best path calculation for the route is deferred if
* BGP_NODE_SELECT_DEFER is set
if (debug)
zlog_debug(
- "%s: p=%pBD afi=%s, safi=%s, old_select=%p, new_select=%p",
- __func__, dest, afi2str(afi), safi2str(safi),
- old_select, new_select);
+ "%s: p=%pBD(%s) afi=%s, safi=%s, old_select=%p, new_select=%p",
+ __func__, dest, bgp->name_pretty, afi2str(afi),
+ safi2str(safi), old_select, new_select);
/* If best route remains the same and this is not due to user-initiated
* clear, see exactly what needs to be done.
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[3];
old_best = NULL;
- bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ bgp_path_info_mpath_update(NULL, &test_rn, new_best, old_best, &mp_list,
&mp_cfg);
bgp_mp_list_clear(&mp_list);
EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 2, test_result);
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[0];
old_best = &test_mp_list_info[3];
- bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ bgp_path_info_mpath_update(NULL, &test_rn, new_best, old_best, &mp_list,
&mp_cfg);
bgp_mp_list_clear(&mp_list);
EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 1, test_result);