summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-09-28 14:17:20 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-10-09 17:53:23 +0200
commit09ee846d9275b4cb0b77f7e458aba6a71b111c52 (patch)
tree21fd5d815e7f7b7dc7d6dd3a473ece834c2d024c /nest/rt-table.c
parent759b204be33fa8485c9e28038ee029a49e2e9d3f (diff)
BGP: AIGP metric support (RFC 7311)
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r--nest/rt-table.c14
1 files changed, 13 insertions, 1 deletions
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;