summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/babel/babel.c2
-rw-r--r--proto/bfd/bfd.c8
-rw-r--r--proto/bfd/bfd.h2
-rw-r--r--proto/mrt/mrt.c5
-rw-r--r--proto/mrt/mrt.h1
-rw-r--r--proto/ospf/iface.c6
-rw-r--r--proto/ospf/neighbor.c4
-rw-r--r--proto/radv/radv.c4
-rw-r--r--proto/rpki/rpki.c2
9 files changed, 16 insertions, 18 deletions
diff --git a/proto/babel/babel.c b/proto/babel/babel.c
index 40e85a16..515b27e5 100644
--- a/proto/babel/babel.c
+++ b/proto/babel/babel.c
@@ -1747,7 +1747,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
TRACE(D_EVENTS, "Adding interface %s", new->name);
- pool *pool = rp_new(p->p.pool, new->name);
+ pool *pool = rp_new(p->p.pool, p->p.loop, new->name);
ifa = mb_allocz(pool, sizeof(struct babel_iface));
ifa->proto = p;
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c
index dd3488d4..c9b12aa1 100644
--- a/proto/bfd/bfd.c
+++ b/proto/bfd/bfd.c
@@ -452,8 +452,8 @@ bfd_add_session(struct bfd_proto *p, ip_addr addr, ip_addr local, struct iface *
s->passive = s->cf.passive;
s->tx_csn = random_u32();
- s->tx_timer = tm_new_init(p->tpool, bfd_tx_timer_hook, s, 0, 0);
- s->hold_timer = tm_new_init(p->tpool, bfd_hold_timer_hook, s, 0, 0);
+ s->tx_timer = tm_new_init(p->p.pool, bfd_tx_timer_hook, s, 0, 0);
+ s->hold_timer = tm_new_init(p->p.pool, bfd_hold_timer_hook, s, 0, 0);
bfd_session_update_tx_interval(s);
bfd_session_control_tx_timer(s, 1);
@@ -581,7 +581,7 @@ bfd_get_iface(struct bfd_proto *p, ip_addr local, struct iface *iface)
struct bfd_config *cf = (struct bfd_config *) (p->p.cf);
struct bfd_iface_config *ic = bfd_find_iface_config(cf, iface);
- ifa = mb_allocz(p->tpool, sizeof(struct bfd_iface));
+ ifa = mb_allocz(p->p.pool, sizeof(struct bfd_iface));
ifa->local = local;
ifa->iface = iface;
ifa->cf = ic;
@@ -1062,8 +1062,6 @@ bfd_start(struct proto *P)
pthread_spin_init(&p->lock, PTHREAD_PROCESS_PRIVATE);
- p->tpool = rp_new(P->pool, "BFD loop pool");
-
p->session_slab = sl_new(P->pool, sizeof(struct bfd_session));
HASH_INIT(p->session_hash_id, P->pool, 8);
HASH_INIT(p->session_hash_ip, P->pool, 8);
diff --git a/proto/bfd/bfd.h b/proto/bfd/bfd.h
index 8430064b..475b3a11 100644
--- a/proto/bfd/bfd.h
+++ b/proto/bfd/bfd.h
@@ -90,8 +90,6 @@ struct bfd_proto
pthread_spinlock_t lock;
- pool *tpool;
-
node bfd_node;
slab *session_slab;
diff --git a/proto/mrt/mrt.c b/proto/mrt/mrt.c
index b40592d2..e12f7743 100644
--- a/proto/mrt/mrt.c
+++ b/proto/mrt/mrt.c
@@ -561,10 +561,11 @@ mrt_rib_table_dump(struct mrt_table_dump_state *s, net *n, int add_path)
static struct mrt_table_dump_state *
mrt_table_dump_init(pool *pp)
{
- pool *pool = rp_new(pp, "MRT Table Dump");
+ pool *pool = rp_new(pp, &main_birdloop, "MRT Table Dump");
struct mrt_table_dump_state *s = mb_allocz(pool, sizeof(struct mrt_table_dump_state));
s->pool = pool;
+ s->parent = pp;
s->linpool = lp_new(pool, 4080);
s->peer_lp = lp_new(pool, 4080);
mrt_buffer_init(&s->buf, pool, 2 * MRT_ATTR_BUFFER_SIZE);
@@ -601,7 +602,7 @@ mrt_table_dump_free(struct mrt_table_dump_state *s)
config_del_obstacle(s->config);
- rfree(s->pool);
+ rp_free(s->pool, s->parent);
}
diff --git a/proto/mrt/mrt.h b/proto/mrt/mrt.h
index 04865089..2e616f6f 100644
--- a/proto/mrt/mrt.h
+++ b/proto/mrt/mrt.h
@@ -67,6 +67,7 @@ struct mrt_table_dump_state {
/* Allocated by mrt_table_dump_init() */
pool *pool; /* Pool for table dump */
+ pool *parent; /* Parent pool for cleanup */
linpool *linpool; /* Temporary linear pool */
linpool *peer_lp; /* Linear pool for peer entries in peer_hash */
buffer buf; /* Buffer for MRT messages */
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 4cd45033..2aae341a 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -311,7 +311,7 @@ ospf_iface_remove(struct ospf_iface *ifa)
ospf_iface_sm(ifa, ISM_DOWN);
rem_node(NODE ifa);
- rfree(ifa->pool);
+ rp_free(ifa->pool, p->p.pool);
}
void
@@ -567,7 +567,7 @@ ospf_iface_new(struct ospf_area *oa, struct ifa *addr, struct ospf_iface_patt *i
OSPF_TRACE(D_EVENTS, "Adding interface %s (%N) to area %R",
iface->name, &addr->prefix, oa->areaid);
- pool = rp_new(p->p.pool, "OSPF Interface");
+ pool = rp_new(p->p.pool, p->p.loop, "OSPF Interface");
ifa = mb_allocz(pool, sizeof(struct ospf_iface));
ifa->iface = iface;
ifa->addr = addr;
@@ -687,7 +687,7 @@ ospf_iface_new_vlink(struct ospf_proto *p, struct ospf_iface_patt *ip)
/* Vlink ifname is stored just after the ospf_iface structure */
- pool = rp_new(p->p.pool, "OSPF Vlink");
+ pool = rp_new(p->p.pool, p->p.loop, "OSPF Vlink");
ifa = mb_allocz(pool, sizeof(struct ospf_iface) + 16);
ifa->oa = p->backbone;
ifa->cf = ip;
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index ca369819..48e38556 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -80,7 +80,7 @@ struct ospf_neighbor *
ospf_neighbor_new(struct ospf_iface *ifa)
{
struct ospf_proto *p = ifa->oa->po;
- struct pool *pool = rp_new(p->p.pool, "OSPF Neighbor");
+ struct pool *pool = rp_new(p->p.pool, p->p.loop, "OSPF Neighbor");
struct ospf_neighbor *n = mb_allocz(pool, sizeof(struct ospf_neighbor));
n->pool = pool;
@@ -120,7 +120,7 @@ ospf_neigh_down(struct ospf_neighbor *n)
s_get(&(n->dbsi));
release_lsrtl(p, n);
rem_node(NODE n);
- rfree(n->pool);
+ rp_free(n->pool, p->p.pool);
OSPF_TRACE(D_EVENTS, "Neighbor %R on %s removed", rid, ifa->ifname);
}
diff --git a/proto/radv/radv.c b/proto/radv/radv.c
index d572c1b7..b0f15514 100644
--- a/proto/radv/radv.c
+++ b/proto/radv/radv.c
@@ -284,7 +284,7 @@ radv_iface_new(struct radv_proto *p, struct iface *iface, struct radv_iface_conf
RADV_TRACE(D_EVENTS, "Adding interface %s", iface->name);
- pool *pool = rp_new(p->p.pool, iface->name);
+ pool *pool = rp_new(p->p.pool, p->p.loop, iface->name);
ifa = mb_allocz(pool, sizeof(struct radv_iface));
ifa->pool = pool;
ifa->ra = p;
@@ -317,7 +317,7 @@ radv_iface_remove(struct radv_iface *ifa)
rem_node(NODE ifa);
- rfree(ifa->pool);
+ rp_free(ifa->pool, p->p.pool);
}
static void
diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c
index cc86ab6a..afba2216 100644
--- a/proto/rpki/rpki.c
+++ b/proto/rpki/rpki.c
@@ -596,7 +596,7 @@ rpki_check_expire_interval(uint seconds)
static struct rpki_cache *
rpki_init_cache(struct rpki_proto *p, struct rpki_config *cf)
{
- pool *pool = rp_new(p->p.pool, cf->hostname);
+ pool *pool = rp_new(p->p.pool, p->p.loop, cf->hostname);
struct rpki_cache *cache = mb_allocz(pool, sizeof(struct rpki_cache));