]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
If the user has specified identical preferences for instances of different
authorMartin Mares <mj@ucw.cz>
Wed, 1 Mar 2000 11:48:11 +0000 (11:48 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 1 Mar 2000 11:48:11 +0000 (11:48 +0000)
protocols, break the tie by comparing addresses, so we keep the ordering
unambiguous.

nest/rt-table.c

index dcde0af865935b961d6f9cfa9cc01a7adc83de60..4c406cf7c3dd0ccd4e13bacd46062fc635550a2c 100644 (file)
@@ -95,7 +95,14 @@ rte_better(rte *new, rte *old)
   if (new->pref < old->pref)
     return 0;
   if (new->attrs->proto->proto != old->attrs->proto->proto)
-    bug("Different protocols, but identical preferences => oops");     /* FIXME */
+    {
+      /*
+       *  If the user has configured protocol preferences, so that two different protocols
+       *  have the same preference, try to break the tie by comparing addresses. Not too
+       *  useful, but keeps the ordering of routes unambiguous.
+       */
+      return new->attrs->proto->proto > old->attrs->proto->proto;
+    }
   if (better = new->attrs->proto->rte_better)
     return better(new, old);
   return 0;