[zebra] ignore dead routes in RIB update
2008-08-17 Stephen Hemminger <stephen.hemminger@vyatta.com>
* zebra_rib.c: When doing a RIB update, routes in process of removal
should be ignored. This fixes bugs where a route is removed but a
recursive route is not changed.
Signed-off-by: Paul Jakma <paul@quagga.net>
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 4cb72ba..09f3597 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -376,8 +376,12 @@
/* Pick up selected route. */
for (match = rn->info; match; match = match->next)
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
/* If there is no selected route or matched route is EGP, go up
tree. */
@@ -473,8 +477,12 @@
/* Pick up selected route. */
for (match = rn->info; match; match = match->next)
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
/* If there is no selected route or matched route is EGP, go up
tree. */
@@ -560,8 +568,12 @@
/* Pick up selected route. */
for (match = rn->info; match; match = match->next)
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
/* If there is no selected route or matched route is EGP, go up
tree. */
@@ -613,10 +625,13 @@
/* Unlock node. */
route_unlock_node (rn);
- /* Pick up selected route. */
for (match = rn->info; match; match = match->next)
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
if (! match || match->type == ZEBRA_ROUTE_BGP)
return NULL;
@@ -668,12 +683,12 @@
/* Find out if a "selected" RR for the discovered RIB entry exists ever. */
for (match = rn->info; match; match = match->next)
- {
- if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
- continue;
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
- }
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
/* None such found :( */
if (!match)
@@ -735,8 +750,12 @@
/* Pick up selected route. */
for (match = rn->info; match; match = match->next)
- if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
- break;
+ {
+ if (CHECK_FLAG (match->status, RIB_ENTRY_REMOVED))
+ continue;
+ if (CHECK_FLAG (match->flags, ZEBRA_FLAG_SELECTED))
+ break;
+ }
/* If there is no selected route or matched route is EGP, go up
tree. */