diff options
| author | Enke Chen <enchen@paloaltonetworks.com> | 2025-01-09 12:02:02 -0800 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2025-01-10 14:27:46 +0000 |
| commit | d7f5113d901c51049df03d3afa2aaf1cac6a6188 (patch) | |
| tree | 0c4da19af75446800a9e64778e8a7af125887aca /bgpd | |
| parent | 7426f0bac7805026a5f98eaa6c84745edb06b899 (diff) | |
bgpd: use igpmetric in bgp_aigp_metric_total()
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 <enchen@paloaltonetworks.com>
(cherry picked from commit b89e66a3bcd5644278f34ec5899b071066e102a1)
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_attr.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 10e6b0ffcc..74cff5a3a3 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -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) |
