mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-07 09:31:07 +08:00
wintun: Revise interface creation wait
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>
This commit is contained in:

committed by
Jason A. Donenfeld

parent
26af6c4651
commit
11f5780250
@@ -291,6 +291,11 @@ func TestSetupDiOpenDevRegKey(t *testing.T) {
|
||||
t.Errorf("Error calling SetupDiOpenDevRegKey: %s", err.Error())
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
_, err = devInfoList.GetInterfaceID(data)
|
||||
if err != nil {
|
||||
t.Errorf("Error calling GetInterfaceID: %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user