-/* $OpenBSD: route.c,v 1.403 2022/04/19 15:44:56 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.404 2022/04/19 19:19:31 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
int rttrash; /* routes not in table but not freed */
int ifatrash; /* ifas not in ifp list but not free */
-struct pool rtentry_pool; /* pool for rtentry structures */
-struct pool rttimer_pool; /* pool for rttimer structures */
+struct pool rtentry_pool; /* pool for rtentry structures */
+struct pool rttimer_pool; /* pool for rttimer structures */
+struct pool rttimer_queue_pool; /* pool for rttimer_queue structures */
int rt_setgwroute(struct rtentry *, u_int);
void rt_putgwroute(struct rtentry *);
{
rtcounters = counters_alloc(rts_ncounters);
- pool_init(&rtentry_pool, sizeof(struct rtentry), 0, IPL_SOFTNET, 0,
+ pool_init(&rtentry_pool, sizeof(struct rtentry), 0, IPL_MPFLOOR, 0,
"rtentry", NULL);
while (rt_hashjitter == 0)
{
static struct timeout rt_timer_timeout;
- pool_init(&rttimer_pool, sizeof(struct rttimer), 0, IPL_SOFTNET, 0,
- "rttmr", NULL);
+ pool_init(&rttimer_pool, sizeof(struct rttimer), 0,
+ IPL_MPFLOOR, 0, "rttmr", NULL);
+ pool_init(&rttimer_queue_pool, sizeof(struct rttimer_queue), 0,
+ IPL_MPFLOOR, 0, "rttmrq", NULL);
LIST_INIT(&rttimer_queue_head);
timeout_set_proc(&rt_timer_timeout, rt_timer_timer, &rt_timer_timeout);
{
struct rttimer_queue *rtq;
- if ((rtq = malloc(sizeof(*rtq), M_RTABLE, M_NOWAIT|M_ZERO)) == NULL)
+ rtq = pool_get(&rttimer_queue_pool, PR_NOWAIT | PR_ZERO);
+ if (rtq == NULL)
return (NULL);
rtq->rtq_timeout = timeout;
}
LIST_REMOVE(rtq, rtq_link);
- free(rtq, M_RTABLE, sizeof(*rtq));
+ pool_put(&rttimer_queue_pool, rtq);
}
unsigned long