summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2025-01-07 09:41:08 -0500
committerGitHub <noreply@github.com>2025-01-07 09:41:08 -0500
commit6060d8b3479ea390d66dd6c4ce069af363580fa8 (patch)
tree22e1391b6f2600d3bd0918891a298654c30cbdf9 /bgpd
parent8ed117ae1954fc679b03ad273f3658190a2eb74a (diff)
parentfa8663141e2781dc3fc894c0e58c2e3ca69f2be8 (diff)
Merge pull request #17723 from opensourcerouting/fix/bgpd_metric_worse
bgpd: Respect `bgp bestpath missing-as-worst` for `table-map` as well
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c2
-rw-r--r--bgpd/bgp_route.h1
-rw-r--r--bgpd/bgp_zebra.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 5ac1d26603..f519534192 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -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;
diff --git a/bgpd/bgp_route.h b/bgpd/bgp_route.h
index 474e229575..c071120de9 100644
--- a/bgpd/bgp_route.h
+++ b/bgpd/bgp_route.h
@@ -1013,4 +1013,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 */
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index e3465feda8..7ad9ce4726 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -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;
}