From d471d5fc7ce587ed836ca7fa10a79331bc181d45 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Sat, 20 Mar 2021 23:18:34 +0100 Subject: 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. --- proto/bgp/attrs.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'proto/bgp/attrs.c') 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 -- cgit v1.2.3