summaryrefslogtreecommitdiff
path: root/proto/babel/babel.c
diff options
context:
space:
mode:
Diffstat (limited to 'proto/babel/babel.c')
-rw-r--r--proto/babel/babel.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index 97dca4ac..afd0b1e1 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -645,10 +645,11 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
{
struct {
ea_list l;
- eattr a[3];
+ eattr a[4];
} eattrs = {
- .l.count = 3,
+ .l.count = ARRAY_SIZE(eattrs.a),
.a = {
+ EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, c->preference),
EA_LITERAL_EMBEDDED(&ea_babel_metric, 0, r->metric),
EA_LITERAL_STORE_ADATA(&ea_babel_router_id, 0, &r->router_id, sizeof(r->router_id)),
EA_LITERAL_EMBEDDED(&ea_babel_seqno, 0, r->seqno),
@@ -659,7 +660,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
.source = RTS_BABEL,
.scope = SCOPE_UNIVERSE,
.dest = RTD_UNICAST,
- .pref = c->preference,
.from = r->neigh->addr,
.nh.gw = r->next_hop,
.nh.iface = r->neigh->ifa->iface,
@@ -687,9 +687,10 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
.source = RTS_BABEL,
.scope = SCOPE_UNIVERSE,
.dest = RTD_UNREACHABLE,
- .pref = 1,
};
+ ea_set_attr_u32(&a0.eattrs, &ea_gen_preference, 0, 1);
+
rta *a = rta_lookup(&a0);
rte *rte = rte_get_temp(a, p->p.main_source);
rte->pflags = 0;
@@ -2025,7 +2026,8 @@ babel_get_route_info(rte *rte, byte *buf)
if (e)
memcpy(&rid, e->u.ptr->data, sizeof(u64));
- buf += bsprintf(buf, " (%d/%d) [%lR]", rte->attrs->pref,
+ buf += bsprintf(buf, " (%d/%d) [%lR]",
+ rt_get_preference(rte),
ea_get_int(rte->attrs->eattrs, &ea_babel_metric, BABEL_INFINITY), rid);
}