From 8733ba725d83a688673f3cdae79efcad5991e773 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 11 Jun 2015 09:11:12 -0700 Subject: [PATCH] The CHANGED flag may be set for a route (RIB entry) due to change in interface or nexthop status. However, this route may not be selected as the best and may not be the prior best. The flag needs to be reset after evaluating the route as not doing so may prevent future nexthop validation for this route. --- zebra/zebra_rib.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 7c07d9d245..db679e8575 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1568,7 +1568,10 @@ rib_process (struct route_node *rn) /* Infinit distance. */ if (rib->distance == DISTANCE_INFINITY) - continue; + { + UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED); + continue; + } /* Newly selected rib, the common case. */ if (!select) @@ -1591,26 +1594,41 @@ rib_process (struct route_node *rn) { if (select->type != ZEBRA_ROUTE_CONNECT || rib->metric <= select->metric) - select = rib; + { + UNSET_FLAG (select->flags, ZEBRA_FLAG_CHANGED); + select = rib; + } + else + UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED); continue; } else if (select->type == ZEBRA_ROUTE_CONNECT) - continue; + { + UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED); + continue; + } /* higher distance loses */ if (rib->distance > select->distance) - continue; + { + UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED); + continue; + } /* lower wins */ if (rib->distance < select->distance) { + UNSET_FLAG (select->flags, ZEBRA_FLAG_CHANGED); select = rib; continue; } /* metric tie-breaks equal distance */ if (rib->metric <= select->metric) - select = rib; + { + UNSET_FLAG (select->flags, ZEBRA_FLAG_CHANGED); + select = rib; + } } /* RNODE_FOREACH_RIB_SAFE */ /* After the cycle is finished, the following pointers will be set: -- 2.39.5