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. --- nest/rt-table.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) (limited to 'nest/rt-table.c') diff --git a/nest/rt-table.c b/nest/rt-table.c index a869bb18..844c7a68 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -45,10 +45,6 @@ #include "lib/string.h" #include "lib/alloca.h" -#ifdef CONFIG_BGP -#include "proto/bgp/bgp.h" -#endif - pool *rt_table_pool; static slab *rte_slab; @@ -3022,36 +3018,12 @@ rt_get_igp_metric(rte *rt) if (ea) return ea->u.data; - rta *a = rt->attrs; - -#ifdef CONFIG_OSPF - if ((a->source == RTS_OSPF) || - (a->source == RTS_OSPF_IA) || - (a->source == RTS_OSPF_EXT1)) - return rt->u.ospf.metric1; -#endif - -#ifdef CONFIG_RIP - if (a->source == RTS_RIP) - return rt->u.rip.metric; -#endif - -#ifdef CONFIG_BGP - if (a->source == RTS_BGP) - { - u64 metric = bgp_total_aigp_metric(rt); - return (u32) MIN(metric, (u64) IGP_METRIC_UNKNOWN); - } -#endif - -#ifdef CONFIG_BABEL - if (a->source == RTS_BABEL) - return rt->u.babel.metric; -#endif - - if (a->source == RTS_DEVICE) + if (rt->attrs->source == RTS_DEVICE) return 0; + if (rt->src->proto->rte_igp_metric) + return rt->src->proto->rte_igp_metric(rt); + return IGP_METRIC_UNKNOWN; } -- cgit v1.2.3 From 3660f19dd534224da4870a507efcef5b36794506 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Mon, 17 Feb 2020 11:18:32 +0100 Subject: Dropping the RTS_DUMMY temporary route storage. Kernel route sync is done by other ways now and this code is not used currently. --- doc/bird.sgml | 2 +- filter/test.conf | 1 - nest/config.Y | 2 +- nest/route.h | 1 - nest/rt-attr.c | 3 +-- nest/rt-table.c | 23 ----------------------- proto/ospf/rt.c | 6 +++--- sysdep/linux/netlink.c | 2 -- 8 files changed, 6 insertions(+), 34 deletions(-) (limited to 'nest/rt-table.c') diff --git a/doc/bird.sgml b/doc/bird.sgml index ddad4d98..a2138b55 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1691,7 +1691,7 @@ Common route attributes are: