]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: use igpmetric in bgp_aigp_metric_total()
authorEnke Chen <enchen@paloaltonetworks.com>
Thu, 9 Jan 2025 20:02:02 +0000 (12:02 -0800)
committerEnke Chen <enchen@paloaltonetworks.com>
Thu, 9 Jan 2025 20:02:02 +0000 (12:02 -0800)
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>
bgpd/bgp_attr.h

index c5532f400597ee4575c045e924c9a68c6f302d73..d9fc8331128124625a5e3161b91dac2f7bd4c095 100644 (file)
@@ -604,10 +604,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 void bgp_attr_set_med(struct attr *attr, uint32_t med)