bgp_info_mpath_dequeue (old_best);
}
+ if (debug)
+ zlog_debug("%s: starting mpath update, newbest %s num candidates %d old-mpath-count %d",
+ pfx_buf, new_best ? new_best->peer->host : "NONE",
+ listcount (mp_list), old_mpath_count);
+
/*
* We perform an ordered walk through both lists in parallel.
* The reason for the ordered walk is that if there are paths
*/
while (mp_node || cur_mpath)
{
+ struct bgp_info *tmp_info;
+
/*
* We can bail out of this loop if all existing paths on the
* multipath list have been visited (for cleanup purposes) and
mp_next_node = mp_node ? listnextnode (mp_node) : NULL;
next_mpath = cur_mpath ? bgp_info_mpath_next (cur_mpath) : NULL;
+ tmp_info = mp_node ? listgetdata (mp_node) : NULL;
+
+ if (debug)
+ zlog_debug("%s: comparing candidate %s with existing mpath %s",
+ pfx_buf, tmp_info ? tmp_info->peer->host : "NONE",
+ cur_mpath ? cur_mpath->peer->host : "NONE");
/*
* If equal, the path was a multipath and is still a multipath.
bgp_info_mpath_enqueue (prev_mpath, cur_mpath);
prev_mpath = cur_mpath;
mpath_count++;
+ if (debug)
+ {
+ bgp_info_path_with_addpath_rx_str(cur_mpath, path_buf);
+ zlog_debug("%s: %s is still multipath, cur count %d",
+ pfx_buf, path_buf, mpath_count);
+ }
}
else
{
if (debug)
{
bgp_info_path_with_addpath_rx_str(cur_mpath, path_buf);
- zlog_debug ("%s remove mpath nexthop %s %s", pfx_buf,
+ zlog_debug ("%s: remove mpath %s nexthop %s, cur count %d",
+ pfx_buf, path_buf,
inet_ntop (AF_INET, &cur_mpath->attr->nexthop,
nh_buf[0], sizeof (nh_buf[0])),
- path_buf);
+ mpath_count);
}
}
mp_node = mp_next_node;
if (debug)
{
bgp_info_path_with_addpath_rx_str(cur_mpath, path_buf);
- zlog_debug ("%s remove mpath nexthop %s %s", pfx_buf,
+ zlog_debug ("%s: remove mpath %s nexthop %s, cur count %d",
+ pfx_buf, path_buf,
inet_ntop (AF_INET, &cur_mpath->attr->nexthop,
nh_buf[0], sizeof (nh_buf[0])),
- path_buf);
+ mpath_count);
}
cur_mpath = next_mpath;
}
if (debug)
{
bgp_info_path_with_addpath_rx_str(new_mpath, path_buf);
- zlog_debug ("%s add mpath nexthop %s %s", pfx_buf,
+ zlog_debug ("%s: add mpath %s nexthop %s, cur count %d",
+ pfx_buf, path_buf,
inet_ntop (AF_INET, &new_mpath->attr->nexthop,
nh_buf[0], sizeof (nh_buf[0])),
- path_buf);
+ mpath_count);
}
}
mp_node = mp_next_node;
if (new_best)
{
+ if (debug)
+ zlog_debug("%s: New mpath count (incl newbest) %d mpath-change %s",
+ pfx_buf, mpath_count, mpath_changed ? "YES" : "NO");
+
bgp_info_mpath_count_set (new_best, mpath_count-1);
if (mpath_changed || (bgp_info_mpath_count (new_best) != old_mpath_count))
SET_FLAG (new_best->flags, BGP_INFO_MULTIPATH_CHG);
}
if (debug)
- bgp_info_path_with_addpath_rx_str (exist, exist_buf);
+ {
+ bgp_info_path_with_addpath_rx_str (exist, 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);
+ }
newattr = new->attr;
existattr = exist->attr;
* TODO: If unequal cost ibgp multipath is enabled we can
* mark the paths as equal here instead of returning
*/
+ if (debug)
+ {
+ if (ret == 1)
+ zlog_debug("%s: %s wins over %s after IGP metric comparison",
+ pfx_buf, new_buf, exist_buf);
+ else
+ zlog_debug("%s: %s loses to %s after IGP metric comparison",
+ pfx_buf, new_buf, exist_buf);
+ }
return ret;
}
/* Now that we know which path is the bestpath see if any of the other paths
* qualify as multipaths
*/
- if (do_mpath && new_select)
+ if (debug)
{
- if (debug)
- {
- bgp_info_path_with_addpath_rx_str (new_select, path_buf);
- zlog_debug("%s: %s is the bestpath, now find multipaths", pfx_buf, path_buf);
- }
+ if (new_select)
+ bgp_info_path_with_addpath_rx_str (new_select, path_buf);
+ else
+ sprintf (path_buf, "NONE");
+ zlog_debug("%s: After path selection, newbest is %s oldbest was %s",
+ pfx_buf, path_buf,
+ old_select ? old_select->peer->host : "NONE");
+ }
+ if (do_mpath && new_select)
+ {
for (ri = rn->info; (ri != NULL) && (nextri = ri->next, 1); ri = nextri)
{