diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/babel/babel.c | 5 | ||||
-rw-r--r-- | proto/bgp/attrs.c | 6 | ||||
-rw-r--r-- | proto/bgp/packets.c | 1 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 2 | ||||
-rw-r--r-- | proto/ospf/rt.c | 1 | ||||
-rw-r--r-- | proto/perf/perf.c | 1 | ||||
-rw-r--r-- | proto/pipe/pipe.c | 3 | ||||
-rw-r--r-- | proto/rip/rip.c | 3 | ||||
-rw-r--r-- | proto/rpki/rpki.c | 1 | ||||
-rw-r--r-- | proto/static/static.c | 5 |
10 files changed, 17 insertions, 11 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 68cc62f1..246eea00 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -645,6 +645,7 @@ 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, @@ -676,13 +677,13 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) .source = RTS_BABEL, .scope = SCOPE_UNIVERSE, .dest = RTD_UNREACHABLE, + .pref = 1, }; rta *a = rta_lookup(&a0); rte *rte = rte_get_temp(a); memset(&rte->u.babel, 0, sizeof(rte->u.babel)); rte->pflags = 0; - rte->pref = 1; e->unreachable = 1; rte_update2(c, e->n.addr, rte, p->p.main_source); @@ -2010,7 +2011,7 @@ babel_dump(struct proto *P) static void babel_get_route_info(rte *rte, byte *buf) { - buf += bsprintf(buf, " (%d/%d) [%lR]", rte->pref, rte->u.babel.metric, rte->u.babel.router_id); + buf += bsprintf(buf, " (%d/%d) [%lR]", rte->attrs->pref, rte->u.babel.metric, rte->u.babel.router_id); } static int diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 95d1c337..3bdc7596 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -2117,7 +2117,7 @@ bgp_rte_mergable(rte *pri, rte *sec) static inline int same_group(rte *r, u32 lpref, u32 lasn) { - return (r->pref == lpref) && (bgp_get_neighbor(r) == lasn); + return (r->attrs->pref == lpref) && (bgp_get_neighbor(r) == lasn); } static inline int @@ -2132,7 +2132,7 @@ bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best) { rte *r, *s; rte *key = new ? new : old; - u32 lpref = key->pref; + u32 lpref = key->attrs->pref; u32 lasn = bgp_get_neighbor(key); int old_suppressed = old ? old->u.bgp.suppressed : 0; @@ -2355,7 +2355,7 @@ bgp_get_route_info(rte *e, byte *buf) eattr *o = ea_find(e->attrs->eattrs, EA_CODE(PROTOCOL_BGP, BA_ORIGIN)); u32 origas; - buf += bsprintf(buf, " (%d", e->pref); + buf += bsprintf(buf, " (%d", e->attrs->pref); if (e->u.bgp.suppressed) buf += bsprintf(buf, "-"); diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 99b5d5b4..8d107795 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -2440,6 +2440,7 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis a->scope = SCOPE_UNIVERSE; a->from = s->proto->remote_ip; a->eattrs = ea; + a->pref = c->c.preference; c->desc->decode_next_hop(s, nh, nh_len, a); bgp_finish_attrs(s, a); diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 48e078ed..4b69e011 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -609,7 +609,7 @@ ospf_get_route_info(rte * rte, byte * buf) } buf += bsprintf(buf, " %s", type); - buf += bsprintf(buf, " (%d/%d", rte->pref, rte->u.ospf.metric1); + buf += bsprintf(buf, " (%d/%d", rte->attrs->pref, rte->u.ospf.metric1); if (rte->attrs->source == RTS_OSPF_EXT2) buf += bsprintf(buf, "/%d", rte->u.ospf.metric2); buf += bsprintf(buf, ")"); diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index faee49dc..eb2aa393 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -2058,6 +2058,7 @@ again1: .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, .nh = *(nf->n.nhs), + .pref = p->p.main_channel->preference, }; if (reload || ort_changed(nf, &a0)) diff --git a/proto/perf/perf.c b/proto/perf/perf.c index ba401a8a..692be2c0 100644 --- a/proto/perf/perf.c +++ b/proto/perf/perf.c @@ -147,6 +147,7 @@ perf_loop(void *data) .source = RTS_PERF, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, + .pref = p->p.main_channel->preference, .nh.iface = p->ifa->iface, .nh.gw = gw, .nh.weight = 1, diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index a50d44a3..a2fc2ddf 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -68,14 +68,13 @@ pipe_rt_notify(struct proto *P, struct channel *src_ch, net *n, rte *new, rte *o a = alloca(rta_size(new->attrs)); memcpy(a, new->attrs, rta_size(new->attrs)); - a->aflags = 0; + a->cached = 0; a->hostentry = NULL; e = rte_get_temp(a); e->pflags = 0; /* Copy protocol specific embedded attributes. */ memcpy(&(e->u), &(new->u), sizeof(e->u)); - e->pref = new->pref; e->pflags = new->pflags; #ifdef CONFIG_BGP diff --git a/proto/rip/rip.c b/proto/rip/rip.c index e1a235a0..65147a1f 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -146,6 +146,7 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) /* Update */ rta a0 = { .src = p->p.main_source, + .pref = p->p.main_channel->preference, .source = RTS_RIP, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, @@ -1198,7 +1199,7 @@ rip_reconfigure(struct proto *P, struct proto_config *CF) static void rip_get_route_info(rte *rte, byte *buf) { - buf += bsprintf(buf, " (%d/%d)", rte->pref, rte->u.rip.metric); + buf += bsprintf(buf, " (%d/%d)", rte->attrs->pref, rte->u.rip.metric); if (rte->u.rip.tag) bsprintf(buf, " [%04x]", rte->u.rip.tag); diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c index ab0837f3..fefea4b4 100644 --- a/proto/rpki/rpki.c +++ b/proto/rpki/rpki.c @@ -122,6 +122,7 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_ rta a0 = { .src = p->p.main_source, + .pref = channel->preference, .source = RTS_RPKI, .scope = SCOPE_UNIVERSE, .dest = RTD_NONE, diff --git a/proto/static/static.c b/proto/static/static.c index 2789c1bb..2d141c07 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -60,6 +60,7 @@ static_announce_rte(struct static_proto *p, struct static_route *r) a->source = RTS_STATIC; a->scope = SCOPE_UNIVERSE; a->dest = r->dest; + a->pref = p->p.main_channel->preference; if (r->dest == RTD_UNICAST) { @@ -721,9 +722,9 @@ static_get_route_info(rte *rte, byte *buf) { eattr *a = ea_find(rte->attrs->eattrs, EA_GEN_IGP_METRIC); if (a) - buf += bsprintf(buf, " (%d/%u)", rte->pref, a->u.data); + buf += bsprintf(buf, " (%d/%u)", rte->attrs->pref, a->u.data); else - buf += bsprintf(buf, " (%d)", rte->pref); + buf += bsprintf(buf, " (%d)", rte->attrs->pref); } static void |