aboutsummaryrefslogtreecommitdiffstats
path: root/tun/wintun (follow)
Commit message (Collapse)AuthorAgeFilesLines
* wintun: revise GetInterface()Simon Rozman2019-05-241-3/+4
| | | | | | | | | | | - Make foreign interface found error numeric to ease condition detection. - Update GetInterface() documentation. - Make tun.CreateTUN() quit when foreign interface found before attempting to create a Wintun interface with a duplicate name. Creation is futile. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: never return nil, nilJason A. Donenfeld2019-05-231-1/+1
|
* setupapi: trim "Get" from gettersSimon Rozman2019-05-224-52/+52
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: don't try to flush interface, but rather deleteJason A. Donenfeld2019-05-171-9/+0
|
* wintun: make certain methods privateJason A. Donenfeld2019-05-171-23/+38
|
* global: regroup all importsJason A. Donenfeld2019-05-141-1/+1
|
* wintun: registry: fix nitsJason A. Donenfeld2019-05-111-17/+20
|
* wintun: registry: revise value readingSimon Rozman2019-05-112-67/+82
| | | | | | | | | | | | | | - Make getStringValueRetry() reusable for reading any value type. This merges code from GetIntegerValueWait(). - expandString() >> toString() and extend to support REG_MULTI_SZ (to return first value of REG_MULTI_SZ). Furthermore, doing our own UTF-16 to UTF-8 conversion works around a bug in windows/registry's GetStringValue() non-zero terminated string handling. - Provide toInteger() analogous to toString() - GetStringValueWait() tolerates and reads REG_MULTI_SZ too now. It returns REG_MULTI_SZ[0], making GetFirstStringValueWait() redundant. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: call HrRenameConnection in another threadJason A. Donenfeld2019-05-101-2/+3
|
* wintun: enumerate faster by using COMPATDRIVER instead of CLASSDRIVERJason A. Donenfeld2019-05-101-1/+1
|
* wintun: destroy devinfolist after usageJason A. Donenfeld2019-05-101-0/+1
|
* wintun: registry: replace REG_NOTIFY with NOTIFYSimon Rozman2019-05-103-13/+9
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: IpConfig is a MULTI_SZ, and fix errorsJason A. Donenfeld2019-05-102-49/+72
|
* wintun: poll for device keyJason A. Donenfeld2019-05-101-9/+10
| | | | It's actually pretty hard to guess where it is.
* wintun: fix scope of error objectJason A. Donenfeld2019-05-101-5/+6
|
* wintun: wait for interface registry key on device creationSimon Rozman2019-05-106-109/+518
| | | | | | By using RegNotifyChangeKeyValue(). Also disable dead gateway detection. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: fix GUID leading zero paddingSimon Rozman2019-05-091-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: safer aliasing of slice typesJason A. Donenfeld2019-05-035-23/+40
|
* wintun: work around GetInterface staleness bugJason A. Donenfeld2019-05-031-2/+2
|
* wintun: don't retry when not creatingJason A. Donenfeld2019-05-022-9/+26
| | | | | | The only time we're trying to counteract the race condition is when we're creating a driver. When we're simply looking up all drivers, it doesn't make sense to retry.
* wintun: try harder to open registry keyJason A. Donenfeld2019-04-291-2/+2
| | | | | This sucks. Can we please find a deterministic way of doing this instead?
* setupapi: Fix struct size mismatchesSimon Rozman2019-04-194-8/+27
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: actually fix padding by rounding up to sizeof(void*)Jason A. Donenfeld2019-04-191-1/+1
|
* setupapi: Revise DrvInfoDetailData struct size calculationSimon Rozman2019-04-182-3/+7
| | | | | | | Go adds trailing padding to DrvInfoDetailData struct in GOARCH=386 which confuses SetupAPI expecting exactly sizeof(SP_DRVINFO_DETAIL_DATA). Signed-off-by: Simon Rozman <simon@rozman.si>
* windows: use proper constants from updated x/sysJason A. Donenfeld2019-04-133-16/+16
|
* wintun: rename device using undocumented API that netsh.exe usesJason A. Donenfeld2019-04-012-1/+41
|
* wintun: add more retry loopsJason A. Donenfeld2019-04-012-18/+51
|
* wintun: query for NetCfgInstanceId several timesJason A. Donenfeld2019-03-221-5/+16
|
* tun: windows: Make adapter rename asynchronousSimon Rozman2019-03-221-55/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tun: windows: Adapter devices renamed to WINTUN<LUID Index>Simon Rozman2019-03-223-51/+62
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tun: windows: wintun does iocpJason A. Donenfeld2019-03-181-7/+0
|
* wintun: Poll more oftenJason A. Donenfeld2019-03-101-1/+1
|
* wintun: Make errors more descriptiveSimon Rozman2019-03-081-15/+20
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Return correct reboot-req flag on CreateInterface() error tooSimon Rozman2019-03-081-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Fix double-quoted strings escaping on outputSimon Rozman2019-03-082-4/+4
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Introduce SetupAPI enumerator and machineName constsSimon Rozman2019-03-081-4/+7
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: CleanupSimon Rozman2019-03-071-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Refactor network registry key name generationSimon Rozman2019-03-071-22/+18
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Revise interface creation waitSimon Rozman2019-03-073-59/+106
| | | | | | | | | | | | | | | | | | | | DIF_INSTALLDEVICE returns almost immediately, while the device installation continues in the background. It might take a while, before all registry keys and values are populated. Previously, wireguard-go waited for HKLM\SYSTEM\CurrentControlSet\ Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\<id> registry key only. Followed by a SetInterfaceName() method of Wintun struct which tried to access HKLM\SYSTEM\CurrentControlSet\Control\Network\ {4D36E972-E325-11CE-BFC1-08002BE10318}\<id>\Connection registry key might not be available yet. This commit loops until both registry keys are available before returning from CreateInterface() function. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: Resolve some of golint warningsSimon Rozman2019-03-043-17/+26
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* Simplify reading NetCfgInstanceId from registrySimon Rozman2019-03-041-8/+2
| | | | | | | | As querying non-existing registry value and reading non-existing registry string value both return ERROR_FILE_NOT_FOUND, we can use later only. Signed-off-by: Simon Rozman <simon@rozman.si>
* Unify interface-specific network registry key openSimon Rozman2019-03-041-10/+19
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* Change package pathJason A. Donenfeld2019-02-182-3/+3
|
* setupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailDataSimon Rozman2019-02-074-55/+60
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Merge SP_DRVINFO_DATA and DrvInfoDataSimon Rozman2019-02-074-78/+78
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Rename SP_REMOVEDEVICE_PARAMS to RemoveDeviceParamsSimon Rozman2019-02-072-4/+4
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeaderSimon Rozman2019-02-074-20/+20
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Merge _SP_DEVINSTALL_PARAMS and DevInstallParamsSimon Rozman2019-02-074-63/+25
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailDataSimon Rozman2019-02-074-26/+26
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* setupapi: Rename SP_DEVINFO_DATA to DevInfoDataSimon Rozman2019-02-074-81/+81
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>