diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/babel/babel.c | 10 | ||||
-rw-r--r-- | proto/bgp/attrs.c | 20 | ||||
-rw-r--r-- | proto/bgp/packets.c | 4 | ||||
-rw-r--r-- | proto/mrt/mrt.c | 8 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 2 | ||||
-rw-r--r-- | proto/ospf/rt.c | 3 | ||||
-rw-r--r-- | proto/perf/perf.c | 3 | ||||
-rw-r--r-- | proto/pipe/pipe.c | 10 | ||||
-rw-r--r-- | proto/rip/rip.c | 5 | ||||
-rw-r--r-- | proto/rpki/rpki.c | 5 | ||||
-rw-r--r-- | proto/static/static.c | 8 |
11 files changed, 35 insertions, 43 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 246eea00..1d23aef7 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -641,7 +641,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) if (r) { rta a0 = { - .src = p->p.main_source, .source = RTS_BABEL, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, @@ -660,7 +659,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) a0.nh.flags = RNF_ONLINK; rta *a = rta_lookup(&a0); - rte *rte = rte_get_temp(a); + rte *rte = rte_get_temp(a, p->p.main_source); rte->u.babel.seqno = r->seqno; rte->u.babel.metric = r->metric; rte->u.babel.router_id = r->router_id; @@ -673,7 +672,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) { /* Unreachable */ rta a0 = { - .src = p->p.main_source, .source = RTS_BABEL, .scope = SCOPE_UNIVERSE, .dest = RTD_UNREACHABLE, @@ -681,7 +679,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) }; rta *a = rta_lookup(&a0); - rte *rte = rte_get_temp(a); + rte *rte = rte_get_temp(a, p->p.main_source); memset(&rte->u.babel, 0, sizeof(rte->u.babel)); rte->pflags = 0; @@ -2236,7 +2234,7 @@ babel_preexport(struct proto *P, struct rte *new) { struct rta *a = new->attrs; /* Reject our own unreachable routes */ - if ((a->dest == RTD_UNREACHABLE) && (a->src->proto == P)) + if ((a->dest == RTD_UNREACHABLE) && (new->src->proto == P)) return -1; return 0; @@ -2277,7 +2275,7 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net, if (new) { /* Update */ - uint internal = (new->attrs->src->proto == P); + uint internal = (new->src->proto == P); uint rt_seqno = internal ? new->u.babel.seqno : p->update_seqno; uint rt_metric = ea_get_int(new->attrs->eattrs, EA_BABEL_METRIC, 0); u64 rt_router_id = internal ? new->u.babel.router_id : p->router_id; diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 3bdc7596..10706088 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1663,7 +1663,7 @@ bgp_free_prefix(struct bgp_channel *c, struct bgp_prefix *px) int bgp_preexport(struct proto *P, rte *e) { - struct proto *SRC = e->attrs->src->proto; + struct proto *SRC = e->src->proto; struct bgp_proto *p = (struct bgp_proto *) P; struct bgp_proto *src = (SRC->proto == &proto_bgp) ? (struct bgp_proto *) SRC : NULL; @@ -1718,7 +1718,7 @@ bgp_preexport(struct proto *P, rte *e) static ea_list * bgp_update_attrs(struct bgp_proto *p, struct bgp_channel *c, rte *e, ea_list *attrs0, struct linpool *pool) { - struct proto *SRC = e->attrs->src->proto; + struct proto *SRC = e->src->proto; struct bgp_proto *src = (SRC->proto == &proto_bgp) ? (void *) SRC : NULL; struct bgp_export_state s = { .proto = p, .channel = c, .pool = pool, .src = src, .route = e, .mpls = c->desc->mpls }; ea_list *attrs = attrs0; @@ -1846,14 +1846,14 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old) /* If attributes are invalid, we fail back to withdraw */ buck = attrs ? bgp_get_bucket(c, attrs) : bgp_get_withdraw_bucket(c); - path = new->attrs->src->global_id; + path = new->src->global_id; lp_flush(bgp_linpool2); } else { buck = bgp_get_withdraw_bucket(c); - path = old->attrs->src->global_id; + path = old->src->global_id; } px = bgp_get_prefix(c, n->n.addr, c->add_path_tx ? path : 0); @@ -1873,7 +1873,7 @@ bgp_get_neighbor(rte *r) return as; /* If AS_PATH is not defined, we treat rte as locally originated */ - struct bgp_proto *p = (void *) r->attrs->src->proto; + struct bgp_proto *p = (void *) r->src->proto; return p->cf->confederation ?: p->local_as; } @@ -1893,8 +1893,8 @@ rte_stale(rte *r) int bgp_rte_better(rte *new, rte *old) { - struct bgp_proto *new_bgp = (struct bgp_proto *) new->attrs->src->proto; - struct bgp_proto *old_bgp = (struct bgp_proto *) old->attrs->src->proto; + struct bgp_proto *new_bgp = (struct bgp_proto *) new->src->proto; + struct bgp_proto *old_bgp = (struct bgp_proto *) old->src->proto; eattr *x, *y; u32 n, o; @@ -2038,8 +2038,8 @@ bgp_rte_better(rte *new, rte *old) int bgp_rte_mergable(rte *pri, rte *sec) { - struct bgp_proto *pri_bgp = (struct bgp_proto *) pri->attrs->src->proto; - struct bgp_proto *sec_bgp = (struct bgp_proto *) sec->attrs->src->proto; + struct bgp_proto *pri_bgp = (struct bgp_proto *) pri->src->proto; + struct bgp_proto *sec_bgp = (struct bgp_proto *) sec->src->proto; eattr *x, *y; u32 p, s; @@ -2123,7 +2123,7 @@ same_group(rte *r, u32 lpref, u32 lasn) static inline int use_deterministic_med(rte *r) { - struct proto *P = r->attrs->src->proto; + struct proto *P = r->src->proto; return (P->proto == &proto_bgp) && ((struct bgp_proto *) P)->cf->deterministic_med; } diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 8d107795..b8d80513 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1356,8 +1356,6 @@ bgp_rte_update(struct bgp_parse_state *s, net_addr *n, u32 path_id, rta *a0) /* Prepare cached route attributes */ if (s->cached_rta == NULL) { - a0->src = s->last_src; - /* Workaround for rta_lookup() breaking eattrs */ ea_list *ea = a0->eattrs; s->cached_rta = rta_lookup(a0); @@ -1365,7 +1363,7 @@ bgp_rte_update(struct bgp_parse_state *s, net_addr *n, u32 path_id, rta *a0) } rta *a = rta_clone(s->cached_rta); - rte *e = rte_get_temp(a); + rte *e = rte_get_temp(a, s->last_src); e->pflags = 0; e->u.bgp.suppressed = 0; diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c index 8d97c860..ed9ab325 100644 --- a/proto/mrt/mrt.c +++ b/proto/mrt/mrt.c @@ -472,9 +472,9 @@ mrt_rib_table_entry(struct mrt_table_dump_state *s, rte *r) #ifdef CONFIG_BGP /* Find peer index */ - if (r->attrs->src->proto->proto == &proto_bgp) + if (r->src->proto->proto == &proto_bgp) { - struct bgp_proto *p = (void *) r->attrs->src->proto; + struct bgp_proto *p = (void *) r->src->proto; struct mrt_peer_entry *n = HASH_FIND(s->peer_hash, PEER, p->remote_id, p->remote_as, p->remote_ip); @@ -488,7 +488,7 @@ mrt_rib_table_entry(struct mrt_table_dump_state *s, rte *r) /* Path Identifier */ if (s->add_path) - mrt_put_u32(b, r->attrs->src->private_id); + mrt_put_u32(b, r->src->private_id); /* Route Attributes */ mrt_put_u16(b, 0); @@ -519,7 +519,7 @@ mrt_rib_table_dump(struct mrt_table_dump_state *s, net *n, int add_path) continue; /* Skip routes that should be reported in the other phase */ - if (!s->always_add_path && (!rt->attrs->src->private_id != !s->add_path)) + if (!s->always_add_path && (!rt->src->private_id != !s->add_path)) { s->want_add_path = 1; continue; diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 4b69e011..03b16350 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -490,7 +490,7 @@ ospf_preexport(struct proto *P, rte *e) struct ospf_area *oa = ospf_main_area(p); /* Reject our own routes */ - if (e->attrs->src->proto == P) + if (e->src->proto == P) return -1; /* Do not export routes to stub areas */ diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index eb2aa393..cda464e0 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -2053,7 +2053,6 @@ again1: if (nf->n.type) /* Add the route */ { rta a0 = { - .src = p->p.main_source, .source = nf->n.type, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, @@ -2064,7 +2063,7 @@ again1: if (reload || ort_changed(nf, &a0)) { rta *a = rta_lookup(&a0); - rte *e = rte_get_temp(a); + rte *e = rte_get_temp(a, p->p.main_source); rta_free(nf->old_rta); nf->old_rta = rta_clone(a); diff --git a/proto/perf/perf.c b/proto/perf/perf.c index 692be2c0..52784c14 100644 --- a/proto/perf/perf.c +++ b/proto/perf/perf.c @@ -143,7 +143,6 @@ perf_loop(void *data) if (!p->attrs_per_rte || !(i % p->attrs_per_rte)) { struct rta a0 = { - .src = p->p.main_source, .source = RTS_PERF, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, @@ -162,7 +161,7 @@ perf_loop(void *data) clock_gettime(CLOCK_MONOTONIC, &ts_generated); for (uint i=0; i<N; i++) { - rte *e = rte_get_temp(p->data[i].a); + rte *e = rte_get_temp(p->data[i].a, p->p.main_source); e->pflags = 0; rte_update(P, &(p->data[i].net), e); diff --git a/proto/pipe/pipe.c b/proto/pipe/pipe.c index a2fc2ddf..de86b62b 100644 --- a/proto/pipe/pipe.c +++ b/proto/pipe/pipe.c @@ -65,12 +65,14 @@ pipe_rt_notify(struct proto *P, struct channel *src_ch, net *n, rte *new, rte *o if (new) { + src = new->src; + a = alloca(rta_size(new->attrs)); memcpy(a, new->attrs, rta_size(new->attrs)); a->cached = 0; a->hostentry = NULL; - e = rte_get_temp(a); + e = rte_get_temp(a, src); e->pflags = 0; /* Copy protocol specific embedded attributes. */ @@ -79,16 +81,14 @@ pipe_rt_notify(struct proto *P, struct channel *src_ch, net *n, rte *new, rte *o #ifdef CONFIG_BGP /* Hack to cleanup cached value */ - if (e->attrs->src->proto->proto == &proto_bgp) + if (e->src->proto->proto == &proto_bgp) e->u.bgp.stale = -1; #endif - - src = a->src; } else { e = NULL; - src = old->attrs->src; + src = old->src; } src_ch->table->pipe_busy = 1; diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 65147a1f..f2e56e93 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -145,7 +145,6 @@ 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, @@ -190,7 +189,7 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) } rta *a = rta_lookup(&a0); - rte *e = rte_get_temp(a); + rte *e = rte_get_temp(a, p->p.main_source); e->u.rip.from = a0.nh.iface; e->u.rip.metric = rt_metric; @@ -340,7 +339,7 @@ rip_rt_notify(struct proto *P, struct channel *ch UNUSED, struct network *net, s en->valid = RIP_ENTRY_VALID; en->metric = rt_metric; en->tag = rt_tag; - en->from = (new->attrs->src->proto == P) ? new->u.rip.from : NULL; + en->from = (new->src->proto == P) ? new->u.rip.from : NULL; en->iface = new->attrs->nh.iface; en->next_hop = new->attrs->nh.gw; } diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c index fefea4b4..be3d19ab 100644 --- a/proto/rpki/rpki.c +++ b/proto/rpki/rpki.c @@ -121,7 +121,6 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_ struct rpki_proto *p = cache->p; rta a0 = { - .src = p->p.main_source, .pref = channel->preference, .source = RTS_RPKI, .scope = SCOPE_UNIVERSE, @@ -129,11 +128,11 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_ }; rta *a = rta_lookup(&a0); - rte *e = rte_get_temp(a); + rte *e = rte_get_temp(a, p->p.main_source); e->pflags = 0; - rte_update2(channel, &pfxr->n, e, a0.src); + rte_update2(channel, &pfxr->n, e, e->src); } void diff --git a/proto/static/static.c b/proto/static/static.c index 2d141c07..6d3871cc 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -56,7 +56,7 @@ static void static_announce_rte(struct static_proto *p, struct static_route *r) { rta *a = allocz(RTA_MAX_SIZE); - a->src = static_get_source(p, r->index); + struct rte_src *src = static_get_source(p, r->index); a->source = RTS_STATIC; a->scope = SCOPE_UNIVERSE; a->dest = r->dest; @@ -103,7 +103,7 @@ static_announce_rte(struct static_proto *p, struct static_route *r) return; /* We skip rta_lookup() here */ - rte *e = rte_get_temp(a); + rte *e = rte_get_temp(a, src); e->pflags = 0; if (r->cmds) @@ -120,7 +120,7 @@ static_announce_rte(struct static_proto *p, struct static_route *r) e->net = NULL; } - rte_update2(p->p.main_channel, r->net, e, a->src); + rte_update2(p->p.main_channel, r->net, e, src); r->state = SRS_CLEAN; if (r->cmds) @@ -132,7 +132,7 @@ withdraw: if (r->state == SRS_DOWN) return; - rte_update2(p->p.main_channel, r->net, NULL, a->src); + rte_update2(p->p.main_channel, r->net, NULL, src); r->state = SRS_DOWN; } |