]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Respect `bgp bestpath missing-as-worst` for `table-map` as well 17723/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 26 Dec 2024 15:26:42 +0000 (17:26 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 26 Dec 2024 15:26:42 +0000 (17:26 +0200)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_zebra.c

index bd2fda56fc203dc73f98e9533c0a38799f662a7a..14a53583345d8e42225d8a2e76ffc14c75303237 100644 (file)
@@ -649,7 +649,7 @@ static bool use_bgp_med_value(struct attr *attr, struct bgp *bgp)
 
 /* Get MED value.  If MED value is missing and "bgp bestpath
    missing-as-worst" is specified, treat it as the worst value. */
-static uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
+uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp)
 {
        if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_MULTI_EXIT_DISC)))
                return attr->med;
index bde0580d6c7712261ca09abf3be2c92f02cc8ee2..235b5732ed1cd0a35e8c199af0eb02399e54c41f 100644 (file)
@@ -1012,4 +1012,5 @@ extern void bgp_meta_queue_free(struct meta_queue *mq);
 extern int early_route_process(struct bgp *bgp, struct bgp_dest *dest);
 extern int other_route_process(struct bgp *bgp, struct bgp_dest *dest);
 extern int eoiu_marker_process(struct bgp *bgp, struct bgp_dest *dest);
+extern uint32_t bgp_med_value(struct attr *attr, struct bgp *bgp);
 #endif /* _QUAGGA_BGP_ROUTE_H */
index e3465feda861cec7d53a9545e17dba94b69acd36..7ad9ce472603d3954a0409c1833e740a188f4649 100644 (file)
@@ -1339,7 +1339,7 @@ static void bgp_zebra_announce_parse_nexthop(
                         * overridden on 1st nexthop */
                        if (mpinfo == info) {
                                if (metric)
-                                       *metric = mpinfo_cp->attr->med;
+                                       *metric = bgp_med_value(mpinfo_cp->attr, bgp);
                                if (tag)
                                        *tag = mpinfo_cp->attr->tag;
                        }