summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2014-12-18 19:18:22 +0000
committerreyk <reyk@openbsd.org>2014-12-18 19:18:22 +0000
commit61285d8494d86cbb80affe96fa24db00e4b5468b (patch)
treecf886f41de9c01730ff7fe5cda547bec7890d42c
parentuse siphash for pf_lb. for ipv6, we stretch it out a bit, but good enough. (diff)
downloadwireguard-openbsd-61285d8494d86cbb80affe96fa24db00e4b5468b.tar.xz
wireguard-openbsd-61285d8494d86cbb80affe96fa24db00e4b5468b.zip
The VM host might send multiple messages at once but vmt(4) only
processed one of time per second. Change the code to process all queued messages without delay immediately. This fixes two things: a) the vmt time sensor is available on boot when ntpd -s is loaded and b) the random seeding on resume (OS_Resume message) is executed almost immediately and not delayed by about 20 seconds. ok deraadt@
-rw-r--r--sys/dev/vmt.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/vmt.c b/sys/dev/vmt.c
index 76346d31176..500552f70b2 100644
--- a/sys/dev/vmt.c
+++ b/sys/dev/vmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmt.c,v 1.21 2014/12/18 16:30:29 deraadt Exp $ */
+/* $OpenBSD: vmt.c,v 1.22 2014/12/18 19:18:22 reyk Exp $ */
/*
* Copyright (c) 2007 David Crawshaw <david@zentus.com>
@@ -492,6 +492,10 @@ vmt_tclo_tick(void *xarg)
struct vmt_softc *sc = xarg;
u_int32_t rlen;
u_int16_t ack;
+ int delay;
+
+ /* By default, poll every second for new messages */
+ delay = 1;
/* reopen tclo channel if it's currently closed */
if (sc->sc_tclo_rpc.channel == 0 &&
@@ -541,6 +545,9 @@ vmt_tclo_tick(void *xarg)
}
sc->sc_tclo_ping = 0;
+ /* The VM host can queue multiple messages; continue without delay */
+ delay = 0;
+
if (strcmp(sc->sc_rpc_buf, "reset") == 0) {
if (sc->sc_rpc_error != 0) {
@@ -681,8 +688,13 @@ vmt_tclo_tick(void *xarg)
}
}
+ if (sc->sc_rpc_error == 1) {
+ /* On error, give time to recover and wait a second */
+ delay = 1;
+ }
+
out:
- timeout_add_sec(&sc->sc_tclo_tick, 1);
+ timeout_add_sec(&sc->sc_tclo_tick, delay);
}
#define BACKDOOR_OP_I386(op, frame) \