summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2013-10-30 02:13:16 +0000
committerdlg <dlg@openbsd.org>2013-10-30 02:13:16 +0000
commit31b4d49ff4f96d753a25fa61d22c31a5b4183116 (patch)
tree5c3fc005dd4f9d87492ee27d86806b196adcd60b
parentdeprecate taskq_systq() and replace it with extern struct taskq (diff)
downloadwireguard-openbsd-31b4d49ff4f96d753a25fa61d22c31a5b4183116.tar.xz
wireguard-openbsd-31b4d49ff4f96d753a25fa61d22c31a5b4183116.zip
replace workq_add_task with the task api.
this guarantees the reliability of the arc4_reinit task being run by not relying on a pool to give us memory in an interrupt context. ok mpi@
-rw-r--r--sys/dev/rnd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index a140eaa6990..4c20155f8fe 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.143 2013/07/09 08:57:24 blambert Exp $ */
+/* $OpenBSD: rnd.c,v 1.144 2013/10/30 02:13:16 dlg Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
@@ -120,7 +120,7 @@
#include <sys/fcntl.h>
#include <sys/timeout.h>
#include <sys/mutex.h>
-#include <sys/workq.h>
+#include <sys/task.h>
#include <sys/msgbuf.h>
#include <crypto/md5.h>
@@ -547,6 +547,7 @@ struct rc4_ctx arc4random_state = { 0, 0, { 1, 2, 3, 4, 5, 6 } };
struct mutex rndlock = MUTEX_INITIALIZER(IPL_HIGH);
struct timeout arc4_timeout;
+struct task arc4_task;
void arc4_reinit(void *v); /* timeout to start reinit */
void arc4_init(void *, void *); /* actually do the reinit */
@@ -658,7 +659,7 @@ arc4_init(void *v, void *w)
void
arc4_reinit(void *v)
{
- workq_add_task(NULL, 0, arc4_init, NULL, NULL);
+ task_add(systq, &arc4_task);
/* 10 minutes, per dm@'s suggestion */
timeout_add_sec(&arc4_timeout, 10 * 60);
}
@@ -693,6 +694,7 @@ random_start(void)
dequeue_randomness(NULL);
arc4_init(NULL, NULL);
+ task_set(&arc4_task, arc4_init, NULL, NULL);
timeout_set(&arc4_timeout, arc4_reinit, NULL);
arc4_reinit(NULL);
timeout_set(&rnd_timeout, dequeue_randomness, NULL);