]> git.puffer.fish Git - matthieu/frr.git/commitdiff
2006-01-18 Gunnar Stigen <gunnar.stigen@axxessit.no>
authorpaul <paul>
Wed, 18 Jan 2006 14:52:52 +0000 (14:52 +0000)
committerpaul <paul>
Wed, 18 Jan 2006 14:52:52 +0000 (14:52 +0000)
* zebra_rib.c: Take interface metric into account.

zebra/ChangeLog
zebra/zebra_rib.c

index a40d3e93f8439628b97d19b58eec58a7f0beb816..b33180f7d758cfd84b7fab8b74dada8037a7c92e 100644 (file)
@@ -1,3 +1,7 @@
+2006-01-18 Gunnar Stigen <gunnar.stigen@axxessit.no>
+
+       * zebra_rib.c: Take interface metric into account.
+
 2006-01-17 Paul Jakma <paul.jakma@sun.com>
 
        * kernel_socket.c: (ifam_read) Read metric from RTM_NEWADDR.
index fb983bdb1b4b4b18f7d3c24a1bc5c844daf73f68..5d9cb2f68cb842231c70c859d789bfb502e91e89 100644 (file)
@@ -919,10 +919,23 @@ rib_process (struct work_queue *wq, void *data)
       if (rib->distance == DISTANCE_INFINITY)
         continue;
 
-      /* Newly selected rib. */
-      if (! select || rib->distance < select->distance 
-          || rib->type == ZEBRA_ROUTE_CONNECT)
-        select = rib;
+      /* Newly selected rib, the common case. */
+      if (!select)
+        {
+          select = rib;
+          continue;
+        }
+      
+      /* filter route selection in following order:
+       * - lower distance beats higher
+       * - connected beats other types
+       * - 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)
+          select = rib;
     }
   
   /* Deleted route check. */