summaryrefslogtreecommitdiff
path: root/tun/tun_windows.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: apply gofumptJason A. Donenfeld2021-12-091-2/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: move wintun to its own repoJason A. Donenfeld2021-11-041-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wintun: use new swdevice-based API for upcoming Wintun 0.14Jason A. Donenfeld2021-10-121-26/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: windows: set event before waitingJason A. Donenfeld2021-05-071-18/+18
| | | | | | | | | | | In 097af6e ("tun: windows: protect reads from closing") we made sure no functions are running when End() is called, to avoid a UaF. But we still need to kick that event somehow, so that Read() is allowed to exit, in order to release the lock. So this commit calls SetEvent, while moving the closing boolean to be atomic so it can be modified without locks, and then moves to a WaitGroup for the RCU-like pattern. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: windows: rearrange struct to avoid alignment trap on 32bitJason A. Donenfeld2021-05-071-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: windows: send MTU update when forced MTU changesJason A. Donenfeld2021-05-051-0/+4
| | | | | | Otherwise the padding doesn't get updated. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: windows: protect reads from closingJason A. Donenfeld2021-04-261-6/+19
| | | | | | | | | | | | The code previously used the old errors channel for checking, rather than the simpler boolean, which caused issues on shutdown, since the errors channel was meaningless. However, looking at this exposed a more basic problem: Close() and all the other functions that check the closed boolean can race. So protect with a basic RW lock, to ensure that Close() waits for all pending operations to complete. Reported-by: Joshua Sjoding <joshua.sjoding@scjalliance.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: make NativeTun.Close well behaved, not crash on double closeBrad Fitzpatrick2021-02-221-6/+10
| | | | Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
* global: bump copyrightJason A. Donenfeld2021-01-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: make customization of WintunPool and requested GUID more obviousJason A. Donenfeld2021-01-071-10/+3
| | | | | | | | | | | Persnickety consumers can now do: func init() { tun.WintunPool, _ = wintun.MakePool("Flurp") tun.WintunStaticRequestedGUID, _ = windows.GUIDFromString("{5ae2716f-0b3e-4dc4-a8b5-48eba11a6e16}") } Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wintun: log when reboot is suggested by WindowsSimon Rozman2020-11-251-1/+5
| | | | | | | Which really shouldn't happen. But it is a useful information for troubleshooting. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: keep original error when Wintun session start failsSimon Rozman2020-11-251-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* global: switch to using %w instead of %v for ErrorfJason A. Donenfeld2020-11-071-6/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wintun: ring management moved to wintun.dllSimon Rozman2020-11-071-86/+39
| | | | | Signed-off-by: Simon Rozman <simon@rozman.si> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wintun: migrate to wintun.dll APISimon Rozman2020-11-071-10/+18
| | | | | | | | Rather than having every application using Wintun driver reinvent the wheel, the Wintun device/adapter/interface management has been moved from wireguard-go to wintun.dll deployed with Wintun itself. Signed-off-by: Simon Rozman <simon@rozman.si>
* global: update header comments and modulesJason A. Donenfeld2020-05-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tun: windows: serialize write callsJason A. Donenfeld2020-01-071-0/+5
|
* wintun: manage ring memory manuallyJason A. Donenfeld2019-11-221-3/+3
| | | | | It's large and Go's garbage collector doesn't deal with it especially well.
* tun: match windows CreateTUN signature to the Linux variantAvery Pennarun2019-10-171-4/+9
| | | | | Signed-off-by: Avery Pennarun <apenwarr@gmail.com> [zx2c4: fix default value]
* wintun: expose versionJason A. Donenfeld2019-10-081-0/+5
|
* tun: windows: unify error message formatJason A. Donenfeld2019-09-081-2/+2
|
* wintun: take mutex so that deletion uses the right nameJason A. Donenfeld2019-08-301-7/+1
|
* wintun: move ring constants into moduleJason A. Donenfeld2019-08-291-94/+34
|
* wintun: Wintun->InterfaceJason A. Donenfeld2019-08-291-10/+10
|
* wintun: introduce adapter poolsSimon Rozman2019-08-291-5/+5
| | | | | | This makes wintun package reusable for non-WireGuard applications. Signed-off-by: Simon Rozman <simon@rozman.si>
* wintun: make description consistent across fieldsJason A. Donenfeld2019-08-241-1/+1
|
* tun: windows: don't spin unless we really need itJason A. Donenfeld2019-08-191-10/+42
|
* tun: windows: spin for only a millisecond/80Jason A. Donenfeld2019-08-031-1/+1
| | | | Performance stays the same as before.
* tun: windows: styleJason A. Donenfeld2019-07-231-1/+1
|
* tun: windows: close event handle on shutdownJason A. Donenfeld2019-07-221-0/+1
|
* tun: windows: get rid of retry logicJason A. Donenfeld2019-07-191-213/+91
| | | | Things work fine on Windows 8.
* tun: windows: use specific IOCTL codeJason A. Donenfeld2019-07-191-1/+1
|
* tun: windows: open file at startup timeJason A. Donenfeld2019-07-181-0/+9
|
* tun: windows: silently drop packet when ring is fullJason A. Donenfeld2019-07-181-2/+2
|
* tun: windows: switch to NDIS device objectJason A. Donenfeld2019-07-181-2/+6
|
* tun: windows: spin for a bit before falling back to event objectJason A. Donenfeld2019-07-181-4/+19
|
* tun: windows: implement ring buffersSimon Rozman2019-07-171-186/+184
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tun: windows: registration of write buffer no longer requiredJason A. Donenfeld2019-07-051-12/+1
|
* tun: windows: decrease alignment to 4Jason A. Donenfeld2019-07-051-3/+3
|
* tun: windows: delay initial writeJason A. Donenfeld2019-07-041-16/+22
| | | | Otherwise we provoke Wintun 0.3.
* tun: windows: packetNum is unusedJason A. Donenfeld2019-07-011-3/+0
|
* tun: windows: inform wintun of maximum buffer length for writesJason A. Donenfeld2019-06-261-0/+6
|
* tun: windows: never retry open on Windows 10Jason A. Donenfeld2019-06-181-3/+12
|
* tun: remove TUN prefix from types to reduce stutter elsewhereMatt Layher2019-06-141-5/+5
| | | | Signed-off-by: Matt Layher <mdlayher@gmail.com>
* wintun: fix comments and remove hwnd paramJason A. Donenfeld2019-06-101-5/+5
| | | | This now looks more idiomatic.
* wintun: allow controlling GUIDJason A. Donenfeld2019-06-101-1/+9
|
* global: fixup TODO comment spacingJason A. Donenfeld2019-06-061-1/+1
|
* wintun: simplify DeleteInterface method signatureSimon Rozman2019-06-061-2/+2
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tun: windows: obsolete 256 packets per exchange buffer limitationSimon Rozman2019-06-051-2/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tun: windows: mitigate infinite loop in Flush()Jason A. Donenfeld2019-05-311-29/+35
| | | | | It's possible that for whatever reason, we keep returning EOF, resulting in repeated close/open/write operations, except with empty packets.