Skip to content

Commit

Permalink
bgpd: use igpmetric in bgp_aigp_metric_total()
Browse files Browse the repository at this point in the history
Use igpmetric from bgp_path_info in bgp_igp_metric_total() to be
consistent with all other cases, e.g., as in bgp_path_info_cmp().

Signed-off-by: Enke Chen <[email protected]>
(cherry picked from commit b89e66a)
  • Loading branch information
enkechen-panw authored and mergify[bot] committed Jan 10, 2025
1 parent 7426f0b commit d7f5113
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bgpd/bgp_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,11 @@ static inline uint64_t bgp_aigp_metric_total(struct bgp_path_info *bpi)
{
uint64_t aigp = bgp_attr_get_aigp_metric(bpi->attr);

if (bpi->nexthop)
return aigp + bpi->nexthop->metric;
else
/* Don't increment if it's locally sourced */
if (bpi->peer == bpi->peer->bgp->peer_self)
return aigp;

return bpi->extra ? (aigp + bpi->extra->igpmetric) : aigp;
}

static inline struct cluster_list *bgp_attr_get_cluster(const struct attr *attr)
Expand Down

0 comments on commit d7f5113

Please sign in to comment.