]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Change preference to lower-is-better
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 24 Oct 2018 14:24:27 +0000 (16:24 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 24 Oct 2018 14:24:27 +0000 (16:24 +0200)
nest/proto.c
nest/route.h
nest/rt-table.c
proto/babel/babel.c

index 15d6f4de6d9d056b77c5bbe3ab49c0ed64da7c67..b22f6d18fe537551598eeed73caad6744ed32865 100644 (file)
@@ -483,7 +483,7 @@ channel_config_new(const struct channel_class *cc, const char *name, uint net_ty
 
   cf->net_type = net_type;
   cf->ra_mode = RA_OPTIMAL;
-  cf->preference = proto->protocol->preference;
+  cf->preference = 250 - proto->protocol->preference;
 
   add_tail(&proto->channels, &cf->n);
 
index c52b759218e9c5f615c983013c3130929d64fa21..3af86c38e905f2e4751a1a7af7d1789a46db9403 100644 (file)
@@ -666,6 +666,7 @@ extern struct protocol *attr_class_to_protocol[EAP_MAX];
 
 /*
  *     Default protocol preferences
+ *     (effective values are 250-X of these)
  */
 
 #define DEF_PREF_DIRECT                240     /* Directly connected */
index 293138d1271fc768266163dc4d9b879356765237..5a0ef91434db7c74178d73cf8eec4f7c0901a390 100644 (file)
@@ -335,9 +335,9 @@ rte_better(rte *new, rte *old)
   if (!rte_is_valid(new))
     return 0;
 
-  if (new->pref > old->pref)
-    return 1;
   if (new->pref < old->pref)
+    return 1;
+  if (new->pref > old->pref)
     return 0;
   if (new->attrs->src->proto->proto != old->attrs->src->proto->proto)
     {
index 88c4711e5b9436b89f79f0beef17ec35fa685d95..cb5bb7071dd6a823b82413a44a2298508f991aa7 100644 (file)
@@ -664,7 +664,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
     rte *rte = rte_get_temp(a);
     memset(&rte->u.babel, 0, sizeof(rte->u.babel));
     rte->pflags = 0;
-    rte->pref = 1;
+    rte->pref = 65535;
 
     e->unreachable = 1;
     rte_update2(c, e->n.addr, rte, p->p.main_source);