-/* $OpenBSD: route.c,v 1.402 2022/02/22 01:15:02 guenther Exp $ */
+/* $OpenBSD: route.c,v 1.403 2022/04/19 15:44:56 bluhm Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
struct pool rtentry_pool; /* pool for rtentry structures */
struct pool rttimer_pool; /* pool for rttimer structures */
-void rt_timer_init(void);
int rt_setgwroute(struct rtentry *, u_int);
void rt_putgwroute(struct rtentry *);
int rtflushclone1(struct rtentry *, void *, u_int);
*/
LIST_HEAD(, rttimer_queue) rttimer_queue_head;
-static int rt_init_done = 0;
#define RTTIMER_CALLOUT(r) { \
if (r->rtt_func != NULL) { \
{
static struct timeout rt_timer_timeout;
- if (rt_init_done)
- panic("rt_timer_init: already initialized");
-
pool_init(&rttimer_pool, sizeof(struct rttimer), 0, IPL_SOFTNET, 0,
"rttmr", NULL);
LIST_INIT(&rttimer_queue_head);
timeout_set_proc(&rt_timer_timeout, rt_timer_timer, &rt_timer_timeout);
timeout_add_sec(&rt_timer_timeout, 1);
- rt_init_done = 1;
}
struct rttimer_queue *
{
struct rttimer_queue *rtq;
- if (rt_init_done == 0)
- rt_timer_init();
-
if ((rtq = malloc(sizeof(*rtq), M_RTABLE, M_NOWAIT|M_ZERO)) == NULL)
return (NULL);
-/* $OpenBSD: route.h,v 1.187 2021/11/12 15:49:41 deraadt Exp $ */
+/* $OpenBSD: route.h,v 1.188 2022/04/19 15:44:56 bluhm Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
int rt_setgate(struct rtentry *, struct sockaddr *, u_int);
struct rtentry *rt_getll(struct rtentry *);
+void rt_timer_init(void);
int rt_timer_add(struct rtentry *,
void(*)(struct rtentry *, struct rttimer *),
struct rttimer_queue *, u_int);
-/* $OpenBSD: rtable.c,v 1.76 2022/01/02 22:36:04 jsg Exp $ */
+/* $OpenBSD: rtable.c,v 1.77 2022/04/19 15:44:56 bluhm Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
if (rtable_add(0) != 0)
panic("unable to create default routing table");
+
+ rt_timer_init();
}
int