summaryrefslogtreecommitdiff
path: root/proto/bgp/attrs.c
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2021-03-20 23:18:34 +0100
committerMaria Matejka <mq@ucw.cz>2021-10-13 19:09:04 +0200
commitd471d5fc7ce587ed836ca7fa10a79331bc181d45 (patch)
tree557c529dde26bf83da31b5ddcacd5d842d9421bd /proto/bgp/attrs.c
parent5cff1d5f022755df61af6fc21cc4f2e5d384404e (diff)
IGP metric getter refactoring to protocol callback
Direct protocol hooks for IGP metric inside nest/rt-table.c make the protocol API unnecessarily complex. Instead, we use a proper callback.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r--proto/bgp/attrs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 10706088..18d2985c 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -371,6 +371,13 @@ bgp_init_aigp_metric(rte *e, u64 *metric, const struct adata **ad)
return *metric < IGP_METRIC_UNKNOWN;
}
+u32
+bgp_rte_igp_metric(struct rte *rt)
+{
+ u64 metric = bgp_total_aigp_metric(rt);
+ return (u32) MIN(metric, (u64) IGP_METRIC_UNKNOWN);
+}
+
/*
* Attribute hooks