WireGuard / wgctrl-go

Package wgctrl enables control of WireGuard interfaces on multiple platforms.
https://godoc.org/golang.zx2c4.com/wireguard/wgctrl
MIT License
727 stars 85 forks source link

internal/windows: deadlock fix #133

Closed stenya closed 1 year ago

stenya commented 1 year ago

Deadlock (infinite loop) happens when interfaceHandle() is called after the device was closed. Ticket: https://github.com/WireGuard/wgctrl-go/issues/134

Issue explanation in code:

func issueTest() {
 devName := "your-device-name"

 client, _ := wgctrl.New()
 defer client.Close()

 client.Device(devName) // ok

 // TODO: disable (disconnect) WireGuard connection

 client.Device(devName) // BUG: deadlock in interfaceHandle() method !!!
}