Commit graph

445 commits

Author SHA1 Message Date
Simon Rozman dd998ca86a Add support for setupapi.SetupDiCreateDeviceInfo()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 024a4916c2 Add support for setupapi.setupDiCreateDeviceInfoListEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 963be8e993 Stop accessing SetupDiGetDeviceInfoListDetail() output on error
The data returned by SetupDiGetDeviceInfoListDetail() is nil on error
which will cause the test to crash should the function fail.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman e821cdabd2 Unify certain variable names
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 38c7acd70f Simplify SetupDiEnumDeviceInfo() synopsis
The SetupDiEnumDeviceInfo() now returns a SP_DEVINFO_DATA rather than
taking it on input to fill it on return.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 20f1512b7c Change generic local variable names with meaningful replacements
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 348b4e9f7c Add support for setupapi.SetupDiClassGuidsFromNameEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman f81882ee8b Clean an unused constant
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 3e0e61dd26 Replace SetupDiClassNameFromGuid() with SetupDiClassNameFromGuidEx()
The former is only a subset of the later. To minimize future
maintenance, we'll provide support for extended version only.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 9635a0b3a6 Add support for setupapi.SetupDiClassNameFromGuid()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 90b6938ca0 Stop checking for valid handle in DevInfo.Close()
User should not have called or deferred the Close() method should
SetupDiGetClassDevsEx() return an error (and invalid handle). And even
if user does that, a SetupDiDestroyDeviceInfoList(INVALID_HANDLE_VALUE)
is harmless. It just returns ERROR_INVALID_HANDLE - we have a unit test
for this in TestSetupDiDestroyDeviceInfoList().

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 269944002f Add support for setupapi.SetupDiCallClassInstaller()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman a5a1ece32f Add support for setupapi.SetupDi(Get|Set)ClassInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman f1d5db6547 Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman dce5192d86 Add support for setupapi.SetupDiOpenDevRegKey()
Furthermore setupapi.DevInfoData has been obsoleted.
SetupDiEnumDeviceInfo() fills existing SP_DEVINFO_DATA structure now.
As other functions of SetupAPI use SP_DEVINFO_DATA, converting it to
DevInfoData and back would hurt performance.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 955d8dfe04 Add support for setupapi.SetupDiEnumDeviceInfo()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 25e18d01e6 Update exported types and functions annotations
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 45959c116a Add support for setupapi.SetupDiGetDeviceInfoListDetail()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman d41bc015cc Finish support for setupapi.SetupDiGetClassDevsEx()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 31949136df Introduce SetupAPI - Windows device and driver management API
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 6f76edd045 Import windows scafolding 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 3af9aa88a3 noise: store clamped key instead of raw key 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld a5ca02d79a tai64n: whiten nano seconds
Avoid being too precise of a time oracle.
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 2b7562abbb uapi: Simpler function signature 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 89d2c5ed7a Extend structs rather than embed, when possible 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld dff424baf8 Update copyright 2019-02-05 12:59:42 +01:00
Jason A. Donenfeld 6e61c369e8 Properly bubble up setsockopt error from closure 2018-12-25 22:56:36 +01:00
Jason A. Donenfeld 8fde8334dc version: bump snapshot 2018-12-22 17:34:23 +01:00
Jason A. Donenfeld a8326ae753 Make error messages consistent 2018-12-19 00:35:53 +01:00
Jason A. Donenfeld 05cc0c8298 Freebsd is finally normal in sys/unix 2018-12-11 18:33:13 +01:00
Jason A. Donenfeld c967f15e44 Separate out mark setting for Windows 2018-12-11 18:29:46 +01:00
Jason A. Donenfeld 5ace0fdfe2 Use upstream's xchacha20poly1305 2018-12-10 04:23:17 +01:00
Jason A. Donenfeld 849fa400e9 Update go x/ libraries
Android 9's Bionic disallows inotify_init with seccomp, so we want the
latest unix change, and while we're at it, we update the others too.

Reported-by: Berk D. Demir <bdd@mindcast.org>
Go CL: https://go-review.googlesource.com/c/sys/+/153318
Fixes: https://lists.zx2c4.com/pipermail/wireguard/2018-December/003642.html
2018-12-10 04:04:19 +01:00
Jason A. Donenfeld 651744561e tun: remove nonblock hack for linux
This is no longer necessary and actually breaks things

Reported-by: Chris Branch <cbranch@cloudflare.com>
2018-12-06 17:17:51 +01:00
Jason A. Donenfeld 4fd55daafe tai64n: use proper nanoseconds offset
The code before was obviously wrong.

Reported-by: Vlad Krasnov <vlad@cloudflare.com>
2018-11-08 03:58:01 +01:00
Jason A. Donenfeld 276bf973e8 Use darwin tun on ios 2018-11-06 16:24:35 +01:00
Jason A. Donenfeld c37c4ece9e uapi: typo 2018-11-05 05:46:27 +01:00
Jason A. Donenfeld b803276061 receive: make started status uniform 2018-11-01 19:54:25 +01:00
Jason A. Donenfeld 8be1fc9c00 send: do not unlock already freed object 2018-10-18 18:15:24 +02:00
Jason A. Donenfeld 738d027f0b version: bump snapshot 2018-10-18 02:38:29 +02:00
Jason A. Donenfeld 60848b9c72 Makefile: rename default to all 2018-10-17 21:45:16 +02:00
Jason A. Donenfeld 2e772194cf tun: only call .Fd() once
Doing so tends to make the tunnel blocking, so we only retrieve it once
before we call SetNonblock, and then cache the result.
2018-10-17 21:31:42 +02:00
Jason A. Donenfeld 85b2378a07 Use go modules always 2018-10-12 01:45:33 +02:00
Jason A. Donenfeld fddb949002 Do not build if nothing to do 2018-10-12 01:12:56 +02:00
Jason A. Donenfeld 5d6083df7e Switch to go modules 2018-10-09 18:13:56 +02:00
Jason A. Donenfeld b41922e5c8 version: bump snapshot 2018-10-01 17:58:31 +02:00
Jason A. Donenfeld dbb72402f2 Adding missing queueconstants file 2018-10-01 16:11:31 +02:00
Chris Branch 7c971d7ef4 Fix transport message length check
wireguard-go has a bad length check in its transport message handling.
Although it cannot be exploited because of another length check earlier in the
function, this should be fixed regardless.
2018-09-25 05:18:11 +02:00
Jason A. Donenfeld 70bcf9ecb8 Make it easy to restrict queue sizes more 2018-09-25 02:31:02 +02:00
Jason A. Donenfeld ebc7541953 Fix shutdown races 2018-09-24 01:52:02 +02:00