0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

BMP: Move initialization to bmp_start()

That fixes BMP socket allocation from an invalid pool.
This commit is contained in:
Ondrej Zajicek 2023-04-18 15:13:24 +02:00
parent 04e3a76c94
commit fbeef4b74d

View File

@ -498,23 +498,6 @@ bmp_open(const struct proto *P)
{
struct bmp_proto *p = (void *) P;
log(L_DEBUG "Init BMP");
p->buffer_mpool = rp_new(P->pool, "BMP Buffer");
p->map_mem_pool = rp_new(P->pool, "BMP Map");
p->tx_mem_pool = rp_new(P->pool, "BMP Tx");
p->update_msg_mem_pool = rp_new(P->pool, "BMP Update");
p->tx_ev = ev_new_init(p->tx_mem_pool, bmp_fire_tx, p);
bmp_peer_map_init(&p->peer_open_msg.tx_msg, p->map_mem_pool);
bmp_peer_map_init(&p->peer_open_msg.rx_msg, p->map_mem_pool);
bmp_peer_map_init(&p->bgp_peers, p->map_mem_pool);
init_list(&p->tx_queue);
init_list(&p->rt_table_in_pre_policy.update_msg_queue);
p->station_connected = false;
p->started = false;
p->connect_retry_timer = NULL;
if (bmp_open_socket(p) < 0)
{
log(L_DEBUG "Failed to connect to BMP station");
@ -1107,6 +1090,24 @@ bmp_start(struct proto *P)
{
struct bmp_proto *p = (void *) P;
log(L_DEBUG "Init BMP");
p->buffer_mpool = rp_new(P->pool, "BMP Buffer");
p->map_mem_pool = rp_new(P->pool, "BMP Map");
p->tx_mem_pool = rp_new(P->pool, "BMP Tx");
p->update_msg_mem_pool = rp_new(P->pool, "BMP Update");
p->tx_ev = ev_new_init(p->tx_mem_pool, bmp_fire_tx, p);
bmp_peer_map_init(&p->peer_open_msg.tx_msg, p->map_mem_pool);
bmp_peer_map_init(&p->peer_open_msg.rx_msg, p->map_mem_pool);
bmp_peer_map_init(&p->bgp_peers, p->map_mem_pool);
init_list(&p->tx_queue);
init_list(&p->rt_table_in_pre_policy.update_msg_queue);
p->station_connected = false;
p->started = false;
p->connect_retry_timer = NULL;
bmp_setup_socket(p);
bmp_open(P);