diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 1 | ||||
-rw-r--r-- | nest/rt-table.c | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/nest/route.h b/nest/route.h index f4f32ce0..cd4b75db 100644 --- a/nest/route.h +++ b/nest/route.h @@ -652,6 +652,7 @@ void rta_dump(rta *); void rta_dump_all(void); void rta_show(struct cli *, rta *); +u32 rt_get_igp_metric(rte *rt); struct hostentry * rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep); void rta_apply_hostentry(rta *a, struct hostentry *he, mpls_label_stack *mls); diff --git a/nest/rt-table.c b/nest/rt-table.c index c3ec0314..b55bcd40 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -44,6 +44,10 @@ #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; @@ -2934,7 +2938,7 @@ if_local_addr(ip_addr a, struct iface *i) return 0; } -static u32 +u32 rt_get_igp_metric(rte *rt) { eattr *ea = ea_find(rt->attrs->eattrs, EA_GEN_IGP_METRIC); @@ -2956,6 +2960,14 @@ rt_get_igp_metric(rte *rt) 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 + if (a->source == RTS_DEVICE) return 0; |