summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2019-03-25 22:11:08 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2019-09-30 00:20:47 +0200
commit2abd8dbbd8f5b6231f0e1373ae127527cd358a15 (patch)
tree0a6cf5606fe7d7fc0a058408ada5ef67143ae4f7
parentca2dacfcee92d8cfecff74dd020c2d16202b0d5c (diff)
Nest: Recursive bgp routesold/bgp-recursive
Allow recursive routes if they reference a route with higher igp_metric. Max depth set to 10.
-rw-r--r--nest/rt-table.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index c3ec0314..cb3e361c 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2984,12 +2984,25 @@ rt_update_hostentry(rtable *tab, struct hostentry *he)
rta *a = e->attrs;
pxlen = n->n.addr->pxlen;
- if (a->hostentry)
+ int MAX_REC = 10;
+ u32 prev_igp_metric = 0;
+ int i = 0;
+ for (struct hostentry *he = a->hostentry;
+ he && he->src;
+ i++, he = he->src->hostentry)
{
- /* Recursive route should not depend on another recursive route */
- log(L_WARN "Next hop address %I resolvable through recursive route for %N",
- he->addr, n->n.addr);
- goto done;
+ log(L_WARN "Next hop address %I resolvable through recursive route for %N igp_metric %u %u",
+ he->addr, n->n.addr, prev_igp_metric, he->igp_metric);
+
+ if (prev_igp_metric >= he->igp_metric || i >= MAX_REC)
+ {
+ /* Recursive route should not depend on another recursive route */
+ log(L_WARN "Next hop address %I resolvable through deep recursive route for %N",
+ he->addr, n->n.addr);
+ goto done;
+ }
+
+ prev_igp_metric = he->igp_metric;
}
if (a->dest == RTD_UNICAST)