openziti / desktop-edge-win

Provides a Ziti client for Windows
Apache License 2.0
35 stars 13 forks source link

in CreateTun - call to luid.SetRoutes does not complete successfully #111

Closed dovholuknf closed 3 years ago

dovholuknf commented 4 years ago

User is running Win10 running in Virtualbox. Installed the 1.0.5 installer. On upgrade using the installer the error reported in 110 was displayed. I asked for logs from the service and saw an error I'd not seen before:

[  24.155]    INFO : routing destination [{169.254.1.0 ffffff00}] through [169.254.1.0]
[  24.155]   ERROR : unexpected err: Element not found.
[  24.155]   ERROR : the main loop exited with an unexpected error: Element not found.
[  24.155]    INFO : waiting for shutdown to complete

At commit bd937dbf5bc01788e3be089d6f11ba770ebe78c7 this was tracked back (using other log messages) to be called from func (t *RuntimeState) CreateTun(ipv4 string, ipv4mask int) error { image

you can see from the code shown above and the log messages this line was not in the logs: log.Info("routing applied")

If we can discern what went wrong with the wintun code (go pkg:"golang.zx2c4.com/wireguard/windows/tunnel/winipcfg") we should look to contribute back to wintun

dovholuknf commented 3 years ago

this seems to be a race condition that has not been tracked down yet. putting breakpoints in this code and stepping through can trigger this exact error. Also - issue #119 had a similar "Element not found" error due to IPv6 being totally disabled

dovholuknf commented 3 years ago

fixed in 1.4.x timeframe. this was a timing issue. the TUN was not available. fixed by adding a retry loop followed by a retry timeout. 10s is allocated for the interface to become available. for 7.5s a debug message will be produced. from 8 to 10 seconds a warning shows in the logs and a panic triggers at 10s