]> git.puffer.fish Git - matthieu/frr.git/commitdiff
[zebra] Fix incorrect changes made in RIB metric selection patch
authorpaul <paul>
Wed, 25 Jan 2006 06:31:04 +0000 (06:31 +0000)
committerpaul <paul>
Wed, 25 Jan 2006 06:31:04 +0000 (06:31 +0000)
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).

zebra/ChangeLog
zebra/zebra_rib.c

index fab2648073c6c02d5a1f624cd965fd089c3be335..9f892c83336eee029df39c9d67e452f5672129d7 100644 (file)
@@ -1,3 +1,9 @@
+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).
+
 2006-01-25 Paul Jakma <paul.jakma@sun.com>
 
        * (general) More solaris PF_ROUTE hacks. The IFF_UP mangling
index a591776a5b3b9aa243d169099d44da45c7c17cb6..f377400f09c4e1137b11a2a7d5fd4f22af1f3b87 100644 (file)
@@ -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. */