summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-04-18 15:13:24 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-04-18 15:13:24 +0200
commitfbeef4b74dfd73fb86b1ccc5dd1c6109e3c21624 (patch)
treee1c9db395e32e0fb38302534dba4fb489bcbc200 /proto
parent04e3a76c9417d35acdfba96a11327e99000fe47d (diff)
BMP: Move initialization to bmp_start()
That fixes BMP socket allocation from an invalid pool.
Diffstat (limited to 'proto')
-rw-r--r--proto/bmp/bmp.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/proto/bmp/bmp.c b/proto/bmp/bmp.c
index 48d16d6c..23e250f8 100644
--- a/proto/bmp/bmp.c
+++ b/proto/bmp/bmp.c
@@ -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);