summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2020-04-10 17:08:29 +0200
committerMaria Matejka <mq@ucw.cz>2021-10-13 19:09:04 +0200
commit5cff1d5f022755df61af6fc21cc4f2e5d384404e (patch)
treed98b4b352a47257fe3943dcb050ff73c5c14aecf /proto/bgp
parenteb937358c087eaeb6f209660cc7ecfe6d6eff739 (diff)
Route: moved rte_src pointer from rta to rte
It is an auxiliary key in the routing table, not a route attribute.
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c20
-rw-r--r--proto/bgp/packets.c4
2 files changed, 11 insertions, 13 deletions
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;