diff options
author | Maria Matejka <mq@ucw.cz> | 2022-05-30 17:18:03 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-30 17:18:03 +0200 |
commit | 1a92ee9d4df265018c0344064019f53bc3afce3a (patch) | |
tree | 3eb67d0604086b399618bc525a83ce83deac9eb0 /proto/babel | |
parent | 674587d9c84ed70151abc56003c371668079ae31 (diff) | |
parent | 337c04c45e1472d6d9b531a3c55f1f2d30ebf308 (diff) |
Merge commit '337c04c45e1472d6d9b531a3c55f1f2d30ebf308' into haugesund
Diffstat (limited to 'proto/babel')
-rw-r--r-- | proto/babel/babel.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index eaebdb83..6cc6b794 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, @@ -689,9 +689,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); + rte e0 = { .attrs = &a0, .src = p->p.main_source, @@ -2028,7 +2029,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); } |