0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 20:58:44 +00:00

Nest: Change preference to lower-is-better

This commit is contained in:
Ondrej Zajicek (work) 2018-10-24 16:24:27 +02:00
parent 5a96090a5b
commit 668be0ffb3
4 changed files with 5 additions and 4 deletions

View 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->net_type = net_type;
cf->ra_mode = RA_OPTIMAL; cf->ra_mode = RA_OPTIMAL;
cf->preference = proto->protocol->preference; cf->preference = 250 - proto->protocol->preference;
add_tail(&proto->channels, &cf->n); add_tail(&proto->channels, &cf->n);

View File

@ -666,6 +666,7 @@ extern struct protocol *attr_class_to_protocol[EAP_MAX];
/* /*
* Default protocol preferences * Default protocol preferences
* (effective values are 250-X of these)
*/ */
#define DEF_PREF_DIRECT 240 /* Directly connected */ #define DEF_PREF_DIRECT 240 /* Directly connected */

View File

@ -335,9 +335,9 @@ rte_better(rte *new, rte *old)
if (!rte_is_valid(new)) if (!rte_is_valid(new))
return 0; return 0;
if (new->pref > old->pref)
return 1;
if (new->pref < old->pref) if (new->pref < old->pref)
return 1;
if (new->pref > old->pref)
return 0; return 0;
if (new->attrs->src->proto->proto != old->attrs->src->proto->proto) if (new->attrs->src->proto->proto != old->attrs->src->proto->proto)
{ {

View File

@ -664,7 +664,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
rte *rte = rte_get_temp(a); rte *rte = rte_get_temp(a);
memset(&rte->u.babel, 0, sizeof(rte->u.babel)); memset(&rte->u.babel, 0, sizeof(rte->u.babel));
rte->pflags = 0; rte->pflags = 0;
rte->pref = 1; rte->pref = 65535;
e->unreachable = 1; e->unreachable = 1;
rte_update2(c, e->n.addr, rte, p->p.main_source); rte_update2(c, e->n.addr, rte, p->p.main_source);