0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Replacing BGP temporary linpools by the common temporary linpool

This commit is contained in:
Maria Matejka 2022-03-02 11:22:32 +01:00
parent d814a8cb93
commit 06ece3265e
4 changed files with 4 additions and 31 deletions

View File

@ -1854,7 +1854,7 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old)
if (new)
{
struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs->eattrs, bgp_linpool2);
struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs->eattrs, tmp_linpool);
/* Error during attribute processing */
if (!attrs)
@ -1863,8 +1863,6 @@ 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;
lp_flush(bgp_linpool2);
}
else
{

View File

@ -126,9 +126,7 @@
#include "bgp.h"
struct linpool *bgp_linpool; /* Global temporary pool */
struct linpool *bgp_linpool2; /* Global temporary pool for bgp_rt_notify() */
static list bgp_sockets; /* Global list of listening sockets */
static list STATIC_LIST_INIT(bgp_sockets); /* Global list of listening sockets */
static void bgp_connect(struct bgp_proto *p);
@ -161,10 +159,6 @@ bgp_open(struct bgp_proto *p)
uint flags = p->cf->free_bind ? SKF_FREEBIND : 0;
uint flag_mask = SKF_FREEBIND;
/* FIXME: Add some global init? */
if (!bgp_linpool)
init_list(&bgp_sockets);
/* We assume that cf->iface is defined iff cf->local_ip is link-local */
WALK_LIST(bs, bgp_sockets)
@ -204,12 +198,6 @@ bgp_open(struct bgp_proto *p)
add_tail(&bgp_sockets, &bs->n);
if (!bgp_linpool)
{
bgp_linpool = lp_new_default(proto_pool);
bgp_linpool2 = lp_new_default(proto_pool);
}
return 0;
err:
@ -238,15 +226,6 @@ bgp_close(struct bgp_proto *p)
rfree(bs->sk);
rem_node(&bs->n);
mb_free(bs);
if (!EMPTY_LIST(bgp_sockets))
return;
rfree(bgp_linpool);
bgp_linpool = NULL;
rfree(bgp_linpool2);
bgp_linpool2 = NULL;
}
static inline int

View File

@ -20,7 +20,6 @@
#include "lib/hash.h"
#include "lib/socket.h"
struct linpool;
struct eattr;
@ -495,9 +494,6 @@ bgp_parse_error(struct bgp_parse_state *s, uint subcode)
longjmp(s->err_jmpbuf, 1);
}
extern struct linpool *bgp_linpool;
extern struct linpool *bgp_linpool2;
void bgp_start_timer(timer *t, uint value);
void bgp_check_config(struct bgp_config *c);

View File

@ -2335,7 +2335,7 @@ again: ;
struct bgp_write_state s = {
.proto = p,
.channel = c,
.pool = bgp_linpool,
.pool = tmp_linpool,
.mp_reach = (c->afi != BGP_AF_IPV4) || c->ext_next_hop,
.as4_session = p->as4_session,
.add_path = c->add_path_tx,
@ -2518,7 +2518,7 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, uint len)
/* Initialize parse state */
struct bgp_parse_state s = {
.proto = p,
.pool = bgp_linpool,
.pool = tmp_linpool,
.as4_session = p->as4_session,
};