summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-03-01 11:48:11 +0000
committerMartin Mares <mj@ucw.cz>2000-03-01 11:48:11 +0000
commit4c1b4e1a582ea8d13943c46ad87588d5743439cb (patch)
tree9dc106efa5ccb22752ab57d5682f1155dbbd5859 /nest
parentaee539f241dd233eb9e716e11ee2c449ab482a75 (diff)
If the user has specified identical preferences for instances of different
protocols, break the tie by comparing addresses, so we keep the ordering unambiguous.
Diffstat (limited to 'nest')
-rw-r--r--nest/rt-table.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index dcde0af8..4c406cf7 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -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;