summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_mpath.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bgpd/bgp_mpath.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index c773c21..e12d84b 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -129,15 +129,19 @@ int bgp_path_info_nexthop_cmp(struct bgp_path_info *bpi1,
&bpi2->attr->mp_nexthop_global);
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
- addr1 = (bpi1->attr->mp_nexthop_prefer_global)
+ addr1 = (CHECK_FLAG(bpi1->attr->nh_flags,
+ BGP_ATTR_NH_MP_PREFER_GLOBAL))
? bpi1->attr->mp_nexthop_global
: bpi1->attr->mp_nexthop_local;
- addr2 = (bpi2->attr->mp_nexthop_prefer_global)
+ addr2 = (CHECK_FLAG(bpi2->attr->nh_flags,
+ BGP_ATTR_NH_MP_PREFER_GLOBAL))
? bpi2->attr->mp_nexthop_global
: bpi2->attr->mp_nexthop_local;
- if (!bpi1->attr->mp_nexthop_prefer_global
- && !bpi2->attr->mp_nexthop_prefer_global)
+ if (!CHECK_FLAG(bpi1->attr->nh_flags,
+ BGP_ATTR_NH_MP_PREFER_GLOBAL) &&
+ !CHECK_FLAG(bpi2->attr->nh_flags,
+ BGP_ATTR_NH_MP_PREFER_GLOBAL))
compare = !bgp_interface_same(
bpi1->peer->ifp,
bpi2->peer->ifp);
@@ -517,7 +521,7 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
struct bgp_maxpaths_cfg *mpath_cfg)
{
uint16_t maxpaths, mpath_count, old_mpath_count;
- uint32_t bwval;
+ uint64_t bwval;
uint64_t cum_bw, old_cum_bw;
struct listnode *mp_node, *mp_next_node;
struct bgp_path_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
@@ -609,8 +613,11 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
cur_mpath);
prev_mpath = cur_mpath;
mpath_count++;
- if (ecommunity_linkbw_present(
- bgp_attr_get_ecommunity(
+ if (ecommunity_linkbw_present(bgp_attr_get_ecommunity(
+ cur_mpath->attr),
+ &bwval) ||
+ ecommunity_linkbw_present(
+ bgp_attr_get_ipv6_ecommunity(
cur_mpath->attr),
&bwval))
cum_bw += bwval;
@@ -696,8 +703,11 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
prev_mpath = new_mpath;
mpath_changed = 1;
mpath_count++;
- if (ecommunity_linkbw_present(
- bgp_attr_get_ecommunity(
+ if (ecommunity_linkbw_present(bgp_attr_get_ecommunity(
+ new_mpath->attr),
+ &bwval) ||
+ ecommunity_linkbw_present(
+ bgp_attr_get_ipv6_ecommunity(
new_mpath->attr),
&bwval))
cum_bw += bwval;
@@ -720,8 +730,12 @@ void bgp_path_info_mpath_update(struct bgp *bgp, struct bgp_dest *dest,
if (new_best) {
bgp_path_info_mpath_count_set(new_best, mpath_count - 1);
if (mpath_count <= 1 ||
- !ecommunity_linkbw_present(
- bgp_attr_get_ecommunity(new_best->attr), &bwval))
+ (!ecommunity_linkbw_present(bgp_attr_get_ecommunity(
+ new_best->attr),
+ &bwval) &&
+ !ecommunity_linkbw_present(bgp_attr_get_ipv6_ecommunity(
+ new_best->attr),
+ &bwval)))
all_paths_lb = false;
else
cum_bw += bwval;