From 7733c6c4190603a2ec156c917ae07b1b89554569 Mon Sep 17 00:00:00 2001 From: Jorge Boncompte Date: Tue, 25 Jul 2017 12:17:50 +0200 Subject: [PATCH] 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 --- zebra/zebra_rnh.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.39.5