From: Jorge Boncompte Date: Tue, 25 Jul 2017 10:17:50 +0000 (+0200) Subject: zebra: track and compare distance of recursive nexthops X-Git-Tag: frr-4.0-dev~455^2~9 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7733c6c4190603a2ec156c917ae07b1b89554569;p=matthieu%2Ffrr.git zebra: track and compare distance of recursive nexthops Fixes routing loops when backup routes with recursive nexthops of other protocols come and go. Signed-off-by: Jorge Boncompte --- diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 8a326c27fc..8ab46f683c 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -815,6 +815,7 @@ static void copy_state(struct rnh *rnh, struct route_entry *re, state = XCALLOC(MTYPE_RE, sizeof(struct route_entry)); state->type = re->type; + state->distance = re->distance; state->metric = re->metric; route_entry_copy_nexthops(state, re->nexthop); @@ -830,6 +831,9 @@ static int compare_state(struct route_entry *r1, struct route_entry *r2) if ((!r1 && r2) || (r1 && !r2)) return 1; + if (r1->distance != r2->distance) + return 1; + if (r1->metric != r2->metric) return 1;