summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-04-17 07:17:51 +0000
committermpi <mpi@openbsd.org>2015-04-17 07:17:51 +0000
commita17ae16f56a1fb300c31609bab68d470b9cfd53c (patch)
treee7f09d827ccd93a480b51907bd63dbb73e626c38
parentoops, started expecting sockoptlevelname() to handle two arguments (diff)
downloadwireguard-openbsd-a17ae16f56a1fb300c31609bab68d470b9cfd53c.tar.xz
wireguard-openbsd-a17ae16f56a1fb300c31609bab68d470b9cfd53c.zip
Crank the timeout and decrease the buffer size to not end up dropping
all the entropy provided by the device. Also make sure we match the right endpoint. From Sean Levy based on comments from Andreas Gustafsson who's behind Alea.
-rw-r--r--sys/dev/usb/ualea.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/usb/ualea.c b/sys/dev/usb/ualea.c
index b1f558b5fc4..ee995b2c933 100644
--- a/sys/dev/usb/ualea.c
+++ b/sys/dev/usb/ualea.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ualea.c,v 1.1 2015/04/16 08:55:21 mpi Exp $ */
+/* $OpenBSD: ualea.c,v 1.2 2015/04/17 07:17:51 mpi Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
* Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org>
@@ -36,9 +36,10 @@
#include <dev/rndvar.h>
#define ALEA_IFACE 0
+#define ALEA_ENDPOINT 1
#define ALEA_MSECS 100
-#define ALEA_READ_TIMEOUT 1000
-#define ALEA_BUFSIZ ((1024/8)*100) /* 100 kbits */
+#define ALEA_READ_TIMEOUT 5000
+#define ALEA_BUFSIZ 128
#define DEVNAME(_sc) ((_sc)->sc_dev.dv_xname)
@@ -101,7 +102,8 @@ ualea_attach(struct device *parent, struct device *self, void *aux)
return;
}
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
- UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
+ UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK &&
+ UE_GET_ADDR(ed->bEndpointAddress) == ALEA_ENDPOINT) {
ep_ibulk = ed->bEndpointAddress;
break;
}