Commit graph

936 commits

Author SHA1 Message Date
Simon Rozman 4863089120 wintun: Switch to dynamic packet sizes
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-19 18:50:42 +01:00
Jason A. Donenfeld 42c6d0e261 Change package path 2019-02-18 05:11:39 +01:00
Jason A. Donenfeld f7170e5de2 Bump dependencies for ARM ChaCha20 2019-02-14 10:59:54 +01:00
Simon Rozman b719a09a26 wintun: Auto-calculate TUN exchange buffer size
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08 15:21:24 +01:00
Simon Rozman f05f52637f wintun: Simplify Read method()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08 14:31:05 +01:00
Simon Rozman 713477cfb1 wintun: Make constants private and adopt Go recommended case
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08 08:55:23 +01:00
Simon Rozman 5981d5cacf wintun: Check for user close in read loop regardless the load
Do the WaitForSingleObject() always to provide high-load responsiveness.

Reorder events so TUN_SIGNAL_CLOSE has priority over
TUN_SIGNAL_DATA_AVAIL, to provide high-load responsiveness at all.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08 08:48:35 +01:00
Simon Rozman b13739ada2 wintun: Adjust tunRWQueue.left member to match Wintun driver
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08 07:32:12 +01:00
Simon Rozman c4988999ac setupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailData
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:50:43 +01:00
Simon Rozman b662896cf4 setupapi: Merge SP_DRVINFO_DATA and DrvInfoData
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:50:43 +01:00
Simon Rozman 0525f6b112 setupapi: Rename SP_REMOVEDEVICE_PARAMS to RemoveDeviceParams
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:50:43 +01:00
Simon Rozman 9d830826c5 setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:50:43 +01:00
Simon Rozman bd963497da setupapi: Merge _SP_DEVINSTALL_PARAMS and DevInstallParams
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:50:30 +01:00
Simon Rozman 05d25fd1b7 setupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailData
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 23:49:50 +01:00
Simon Rozman 6d2729dccc setupapi: Rename SP_DEVINFO_DATA to DevInfoData
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 22:43:02 +01:00
Simon Rozman d87cbeeb2f wintun: Detect if a foreign interface with the same name exists
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 22:02:51 +01:00
Simon Rozman 043b7e8013 wintun: Clean excessive setupapi.DevInfo.GetDeviceInfoListDetail() call
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 20:49:41 +01:00
Simon Rozman ef48d4fa95 wintun: Explain rationale behind case-insensitive interface names
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 19:42:59 +01:00
Simon Rozman f7276ed522 wintun: Implement TODO in TestSetupDiGetDeviceRegistryProperty()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07 18:59:34 +01:00
Jason A. Donenfeld c4b43e35a7 wintun: add FlushInterface stub 2019-02-07 18:24:28 +01:00
Jason A. Donenfeld 2efafecab5 main_windows: Get iface name from argument 2019-02-07 15:44:07 +01:00
Jason A. Donenfeld fac1fbcd72 wintun: Compare values of GUID, not pointers, when removing 2019-02-07 04:49:15 +01:00
Jason A. Donenfeld 52aa00f3ba main_windows: Catch more exit events 2019-02-07 04:42:35 +01:00
Jason A. Donenfeld ea59177f1c wintun: Introduce new package for obscuring Windows bits 2019-02-07 04:39:59 +01:00
Jason A. Donenfeld 306d08e692 tun_windows: Style 2019-02-07 04:08:05 +01:00
Jason A. Donenfeld 3b7a4fa3ef setupapi: Lower case params 2019-02-07 03:46:31 +01:00
Jason A. Donenfeld 223685875f setupapi: Do not export the toGo/toWindows functions 2019-02-07 02:56:31 +01:00
Jason A. Donenfeld 652158ec3c setupapi: Pass pointers instead of values 2019-02-07 02:37:19 +01:00
Simon Rozman cb2bc4b34c tun_windows: Introduce preliminary TUN interface creation
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 22:30:14 +01:00
Simon Rozman 46279ad0f9 tun_windows: Stop checking minimum size of received TUN packets
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:22:04 +01:00
Simon Rozman 73df1c0871 setupapi: Add DrvInfoDetailData.IsCompatible() to simplify HID detection
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:18:44 +01:00
Simon Rozman 069016bbc4 setupapi: Add SP_DRVINFO_DATA.IsNewer() method to simplify comparison
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:17:47 +01:00
Simon Rozman 3c29434a79 setupapi: Make toUTF16() public and add UTF16ToBuf() counterpart
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-06 20:15:40 +01:00
Jason A. Donenfeld c599bf9497 Fix up errors and paths 2019-02-05 22:06:25 +09:00
Jason A. Donenfeld f7f63765d1 conn: close ipv4 socket when ipv6 socket fails 2019-02-05 21:55:33 +09:00
Simon Rozman 3e8f2e3fa5 setupapi: Add support for driver info lists
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 16:29:17 +01:00
Simon Rozman 7b636380e5 setupapi: Move Go<>Windows struct marshaling to types_windows.go
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 14:03:28 +01:00
Simon Rozman 99a3b628e9 setupapi: Add support for SetupDi(Get|Set)DeviceRegistryProperty()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman e7ffce0d21 setupapi: Introduce DevInfo methods for cleaner code
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman 35f72239ac Add support for setupapi.SetupDi(Get|Set)SelectedDevice()
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
Simon Rozman c15cbefc12 Reorder data-types and functions to match SetupAPI.h
Adding functions with non-consistent order made setupapi package a mess.
While we could reorder data-types and functions by alphabet - it would
make searching easier - it would put ...Get... and ...Set... functions
quite apart.

Therefore, the SetupAPI.h order was adopted.

Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-05 12:59:42 +01:00
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