diff options
author | Maria Matejka <mq@jmq.cz> | 2020-01-28 11:42:46 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-11-09 19:20:41 +0100 |
commit | 69d1ffde4c724882398b3b630ea1199f12c0c288 (patch) | |
tree | a7567e07bcd0aa3f9365da83ed2ac23a10e869b6 /proto/bgp/packets.c | |
parent | 60880b539b8886f76961125d89a265c6e1112b7a (diff) |
Split route data structure to storage (ro) / manipulation (rw) structures.
Routes are now allocated only when they are just to be inserted to the
table. Updating a route needs a locally allocated route structure.
Ownership of the attributes is also now not transfered from protocols to
tables and vice versa but just borrowed which should be easier to handle
in a multithreaded environment.
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r-- | proto/bgp/packets.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 6bc71623..647551e5 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1349,7 +1349,7 @@ bgp_rte_update(struct bgp_parse_state *s, net_addr *n, u32 path_id, rta *a0) if (!a0) { /* Route withdraw */ - rte_update3(&s->channel->c, n, NULL, s->last_src); + rte_update(&s->channel->c, n, NULL, s->last_src); return; } @@ -1362,11 +1362,12 @@ bgp_rte_update(struct bgp_parse_state *s, net_addr *n, u32 path_id, rta *a0) a0->eattrs = ea; } - rta *a = rta_clone(s->cached_rta); - rte *e = rte_get_temp(a, s->last_src); + rte e0 = { + .attrs = s->cached_rta, + .src = s->last_src, + }; - e->pflags = 0; - rte_update3(&s->channel->c, n, e, s->last_src); + rte_update(&s->channel->c, n, &e0, s->last_src); } static void |