summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorpaul <paul>2006-01-25 06:31:04 +0000
committerpaul <paul>2006-01-25 06:31:04 +0000
commita8d9c1f9caae29410b74f138f81d9b07645c47ce (patch)
treeee5285e9e8932ebf89b16bb051c1af78755ade08 /zebra/zebra_rib.c
parent5c78b3d006e6926f938796cffa08e8e14fb8e7af (diff)
[zebra] Fix incorrect changes made in RIB metric selection patch
2006-01-25 Gunnar Stigen <gunnar.stigen@axxessit.no> * zebra_rib.c: (rib_process) Application of Gunnar's earlier metric selection RIB change included incorrect tidy-ups made by commiter. Fix. (NB: any errors here are again due to paul).
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index a591776a..f377400f 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -927,15 +927,37 @@ rib_process (struct work_queue *wq, void *data)
}
/* filter route selection in following order:
- * - lower distance beats higher
* - connected beats other types
+ * - lower distance beats higher
* - lower metric beats higher for equal distance
* - last, hence oldest, route wins tie break.
*/
- if ((rib->type == ZEBRA_ROUTE_CONNECT)
- || (rib->distance <= select->distance))
- if (rib->metric <= select->metric)
+ if (rib->type == ZEBRA_ROUTE_CONNECT)
+ {
+ if (select->type != ZEBRA_ROUTE_CONNECT
+ || rib->metric <= select->metric)
+ {
+ select = rib;
+ continue;
+ }
+ }
+ else if (select->type == ZEBRA_ROUTE_CONNECT)
+ continue;
+
+ /* higher distance loses */
+ if (rib->distance > select->distance)
+ continue;
+
+ /* lower wins */
+ if (rib->distance < select->distance)
+ {
select = rib;
+ continue;
+ }
+
+ /* metric tie-breaks equal distance */
+ if (rib->metric <= select->metric)
+ select = rib;
}
/* Deleted route check. */