]>
git.ipfire.org Git - thirdparty/wireguard-go.git/log
Jason A. Donenfeld [Fri, 10 May 2019 15:34:03 +0000 (17:34 +0200)]
wintun: poll for device key
It's actually pretty hard to guess where it is.
Jason A. Donenfeld [Fri, 10 May 2019 14:59:24 +0000 (16:59 +0200)]
wintun: fix scope of error object
Simon Rozman [Thu, 9 May 2019 08:11:15 +0000 (10:11 +0200)]
wintun: wait for interface registry key on device creation
By using RegNotifyChangeKeyValue(). Also disable dead gateway detection.
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Thu, 9 May 2019 13:33:57 +0000 (15:33 +0200)]
conn: remove scope when sanity checking IP address format
Simon Rozman [Thu, 9 May 2019 09:45:14 +0000 (11:45 +0200)]
wintun: fix GUID leading zero padding
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Fri, 3 May 2019 07:37:29 +0000 (09:37 +0200)]
mod: update deps
Jason A. Donenfeld [Fri, 3 May 2019 07:34:00 +0000 (09:34 +0200)]
setupapi: safer aliasing of slice types
Jason A. Donenfeld [Thu, 2 May 2019 22:11:59 +0000 (00:11 +0200)]
wintun: work around GetInterface staleness bug
Jason A. Donenfeld [Thu, 2 May 2019 21:53:15 +0000 (23:53 +0200)]
wintun: don't retry when not creating
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.
Jason A. Donenfeld [Mon, 29 Apr 2019 12:00:49 +0000 (14:00 +0200)]
wintun: try harder to open registry key
This sucks. Can we please find a deterministic way of doing this
instead?
Jason A. Donenfeld [Mon, 29 Apr 2019 06:09:38 +0000 (08:09 +0200)]
go.mod: use vendored winio
Jason A. Donenfeld [Sat, 20 Apr 2019 02:29:07 +0000 (11:29 +0900)]
tun: freebsd: work around numerous kernel panics on shutdown
There are numerous race conditions. But even this will crash it:
while true; do ifconfig tun0 create; ifconfig tun0 destroy; done
It seems like LLv6 is related, which we're not using anyway, so
explicitly disable it on the interface.
Simon Rozman [Fri, 19 Apr 2019 08:05:04 +0000 (10:05 +0200)]
setupapi: Fix struct size mismatches
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Fri, 19 Apr 2019 01:19:00 +0000 (10:19 +0900)]
setupapi: actually fix padding by rounding up to sizeof(void*)
Jason A. Donenfeld [Thu, 18 Apr 2019 22:53:19 +0000 (07:53 +0900)]
tun: darwin: write routeSocket variable in helper
Otherwise the race detector "complains".
Jason A. Donenfeld [Thu, 18 Apr 2019 22:48:09 +0000 (07:48 +0900)]
main: revise warnings
Jason A. Donenfeld [Thu, 18 Apr 2019 14:22:03 +0000 (23:22 +0900)]
device: send: check packet length before freeing element
Simon Rozman [Thu, 18 Apr 2019 08:37:04 +0000 (10:37 +0200)]
setupapi: Revise DrvInfoDetailData struct size calculation
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>
Jason A. Donenfeld [Fri, 12 Apr 2019 23:58:53 +0000 (01:58 +0200)]
windows: use proper constants from updated x/sys
Jason A. Donenfeld [Fri, 12 Apr 2019 13:27:27 +0000 (15:27 +0200)]
conn: linux: RTA_MARK has moved to x/sys
Simon Rozman [Thu, 11 Apr 2019 17:34:43 +0000 (19:34 +0200)]
tun: windows: Adopt new error codes returned by Wintun
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 11 Apr 2019 17:37:04 +0000 (19:37 +0200)]
tun: windows: do not sleep after OPERATION_ABORTED on write
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Tue, 9 Apr 2019 08:45:36 +0000 (10:45 +0200)]
main_windows: use proper version constant
Jason A. Donenfeld [Tue, 9 Apr 2019 08:39:36 +0000 (10:39 +0200)]
version: put version in right place
Jason A. Donenfeld [Tue, 9 Apr 2019 05:37:22 +0000 (07:37 +0200)]
version: bump snapshot
Jason A. Donenfeld [Tue, 9 Apr 2019 05:36:03 +0000 (07:36 +0200)]
tun: windows: do not sleep after OPERATION_ABORTED
Simon Rozman [Thu, 4 Apr 2019 07:19:35 +0000 (09:19 +0200)]
tun: windows: Retry R/W on ERROR_OPERATION_ABORTED
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 3 Apr 2019 03:40:35 +0000 (05:40 +0200)]
tun: windows: Attempt to reopen handle on all errors
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Mon, 1 Apr 2019 10:00:33 +0000 (12:00 +0200)]
wintun: rename device using undocumented API that netsh.exe uses
Jason A. Donenfeld [Sun, 31 Mar 2019 08:17:11 +0000 (10:17 +0200)]
wintun: add more retry loops
Jason A. Donenfeld [Tue, 26 Mar 2019 14:57:53 +0000 (15:57 +0100)]
tun: windows: cancel ongoing reads on closing and delete after close
This reverts commit
52ec440d7977fad966002c3710ed9df957943407 and adds
some spice.
Jason A. Donenfeld [Fri, 22 Mar 2019 22:48:40 +0000 (16:48 -0600)]
wintun: query for NetCfgInstanceId several times
Jason A. Donenfeld [Fri, 22 Mar 2019 22:45:03 +0000 (16:45 -0600)]
tun: windows: delete interface before deleting file handles
Simon Rozman [Fri, 22 Mar 2019 14:57:23 +0000 (15:57 +0100)]
tun: windows: Make adapter rename asynchronous
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 22 Mar 2019 14:28:33 +0000 (15:28 +0100)]
tun: windows: Adapter devices renamed to WINTUN<LUID Index>
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 22 Mar 2019 11:45:31 +0000 (12:45 +0100)]
tun: windows: Increase unavailable adapter timeout to 30sec
5 seconds was too short when debugging.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 22 Mar 2019 11:44:14 +0000 (12:44 +0100)]
tun: windows: Make writing persistent too
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 22 Mar 2019 11:40:13 +0000 (12:40 +0100)]
tun: windows: Fix paused adapter test
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Thu, 21 Mar 2019 21:20:09 +0000 (15:20 -0600)]
tun: windows: just open two file handles
Jason A. Donenfeld [Thu, 21 Mar 2019 20:43:04 +0000 (14:43 -0600)]
receive: implement flush semantics
Jason A. Donenfeld [Thu, 21 Mar 2019 06:16:07 +0000 (00:16 -0600)]
tun: windows: add dummy overlapped events back
These seem basically wrong to me, but we get crashes without them.
Jason A. Donenfeld [Thu, 21 Mar 2019 05:42:30 +0000 (23:42 -0600)]
tun: windows: use new constants in sys
Jason A. Donenfeld [Thu, 21 Mar 2019 05:40:20 +0000 (23:40 -0600)]
uapi: remove unhelpful log messages
Simon Rozman [Wed, 20 Mar 2019 20:45:40 +0000 (21:45 +0100)]
wintun: Use native Win32 API for I/O
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Tue, 19 Mar 2019 06:34:04 +0000 (00:34 -0600)]
uapi: report endpoint error
Jason A. Donenfeld [Mon, 18 Mar 2019 08:42:00 +0000 (02:42 -0600)]
tun: windows: wintun does iocp
Jason A. Donenfeld [Wed, 13 Mar 2019 08:52:32 +0000 (02:52 -0600)]
tun: windows: temporary hack for forcing MTU
Jason A. Donenfeld [Sun, 10 Mar 2019 02:47:54 +0000 (03:47 +0100)]
wintun: Poll more often
Jason A. Donenfeld [Sun, 10 Mar 2019 01:49:27 +0000 (02:49 +0100)]
uapi: make ipcerror conform to interface
Simon Rozman [Fri, 8 Mar 2019 08:45:59 +0000 (09:45 +0100)]
wintun: Make errors more descriptive
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Mar 2019 08:45:18 +0000 (09:45 +0100)]
wintun: Return correct reboot-req flag on CreateInterface() error too
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Mar 2019 08:43:54 +0000 (09:43 +0100)]
wintun: Fix double-quoted strings escaping on output
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Mar 2019 08:42:34 +0000 (09:42 +0100)]
wintun: Introduce SetupAPI enumerator and machineName consts
Signed-off-by: Simon Rozman <simon@rozman.si>
Odd Stranne [Wed, 6 Mar 2019 13:58:25 +0000 (14:58 +0100)]
Windows: Apply strict security descriptor on pipe server
Signed-off-by: Odd Stranne <odd@mullvad.net>
Jason A. Donenfeld [Fri, 8 Mar 2019 00:40:54 +0000 (01:40 +0100)]
uapi: windows: work out pipe semantics
Pipes can be arranged like this, so that's fine. We also apply a strict
SDDL that can't be inherited and only gives access to local system.
Developed-with: Odd Stranne <odd@mullvad.net>
Simon Rozman [Thu, 7 Mar 2019 14:45:17 +0000 (15:45 +0100)]
wintun: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Mar 2019 14:34:34 +0000 (15:34 +0100)]
wintun: Refactor network registry key name generation
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Mar 2019 14:19:27 +0000 (15:19 +0100)]
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>
Jason A. Donenfeld [Thu, 7 Mar 2019 01:03:48 +0000 (02:03 +0100)]
receive: squelch tear down error
Jason A. Donenfeld [Thu, 7 Mar 2019 00:51:41 +0000 (01:51 +0100)]
tun: linux: work out netpoll trick
Simon Rozman [Mon, 4 Mar 2019 13:27:16 +0000 (14:27 +0100)]
wintun: Resolve some of golint warnings
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Mon, 4 Mar 2019 13:08:13 +0000 (14:08 +0100)]
Elaborate the failing step when forwarding errors on return
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Mon, 4 Mar 2019 12:25:18 +0000 (13:25 +0100)]
Simplify reading NetCfgInstanceId from registry
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>
Simon Rozman [Mon, 4 Mar 2019 10:58:02 +0000 (11:58 +0100)]
Unify interface-specific network registry key open
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Sun, 3 Mar 2019 04:20:13 +0000 (05:20 +0100)]
tun: import mobile particularities
Jason A. Donenfeld [Sun, 3 Mar 2019 04:01:06 +0000 (05:01 +0100)]
boundif: introduce API for socket binding
Jason A. Donenfeld [Sun, 3 Mar 2019 03:04:41 +0000 (04:04 +0100)]
global: begin modularization
Jason A. Donenfeld [Thu, 28 Feb 2019 23:11:12 +0000 (00:11 +0100)]
tun: windows: expose GUID
Jason A. Donenfeld [Thu, 28 Feb 2019 23:05:57 +0000 (00:05 +0100)]
tun: allow special methods in NativeTun
Jason A. Donenfeld [Wed, 27 Feb 2019 03:10:01 +0000 (04:10 +0100)]
tun: linux: netpoll is broken for tun's epoll
So this mostly reverts the switch to Sysconn for Linux.
Issue: https://github.com/golang/go/issues/30426
Jason A. Donenfeld [Wed, 27 Feb 2019 01:20:17 +0000 (02:20 +0100)]
tun: linux: netlink sock needs cleaning up but file will be gc'd
Jason A. Donenfeld [Wed, 27 Feb 2019 00:48:58 +0000 (01:48 +0100)]
tun: use netpoll instead of rwcancel
The new sysconn function of Go 1.12 makes this possible:
package main
import "log"
import "os"
import "unsafe"
import "time"
import "syscall"
import "sync"
import "golang.org/x/sys/unix"
func main() {
fd, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
if err != nil {
log.Fatal(err)
}
var ifr [unix.IFNAMSIZ + 64]byte
copy(ifr[:], []byte("cheese"))
*(*uint16)(unsafe.Pointer(&ifr[unix.IFNAMSIZ])) = unix.IFF_TUN
var errno syscall.Errno
s, _ := fd.SyscallConn()
s.Control(func(fd uintptr) {
_, _, errno = unix.Syscall(
unix.SYS_IOCTL,
fd,
uintptr(unix.TUNSETIFF),
uintptr(unsafe.Pointer(&ifr[0])),
)
})
if errno != 0 {
log.Fatal(errno)
}
b := [4]byte{}
wait := sync.WaitGroup{}
wait.Add(1)
go func() {
_, err := fd.Read(b[:])
log.Print("Read errored: ", err)
wait.Done()
}()
time.Sleep(time.Second)
log.Print("Closing")
err = fd.Close()
if err != nil {
log.Print("Close errored: " , err)
}
wait.Wait()
log.Print("Exiting")
}
Jason A. Donenfeld [Wed, 27 Feb 2019 00:06:43 +0000 (01:06 +0100)]
tun: use sysconn instead of .Fd with Go 1.12
Jason A. Donenfeld [Fri, 22 Feb 2019 19:59:43 +0000 (20:59 +0100)]
Rearrange imports
Jason A. Donenfeld [Fri, 22 Feb 2019 18:33:28 +0000 (19:33 +0100)]
device: send persistent keepalive when bringing up device
Reported-by: Marcelo Bello
Simon Rozman [Fri, 22 Feb 2019 15:16:14 +0000 (16:16 +0100)]
wintun: Read/write packet size from/to exchange buffer directly
Driver <-> user-space communication is local and using native endian.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 22 Feb 2019 15:11:33 +0000 (16:11 +0100)]
wintun: Make two-step slicing a one step
Stop relying to Go compiler optimizations and calculate the end offset
directly.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 19:13:33 +0000 (20:13 +0100)]
wintun: Write exchange buffer increased back to 1MiB
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 19:10:24 +0000 (20:10 +0100)]
wintun: Migrate from unsafe buffer handling to encoding/binary
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 18:56:10 +0000 (19:56 +0100)]
wintun: Adopt new packet data alignment
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 17:38:18 +0000 (18:38 +0100)]
wintun: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 12:12:08 +0000 (13:12 +0100)]
wintun: Add TUN device locking
In case reading from TUN device detected TUN device was closed, it
closed the file handle and set tunFile to nil. The tunFile is
automatically reopened on retry, but... If another packet comes in the
WireGuard calls Write() method. With tunFile set to nil, this will
cause access violation.
Therefore, locking was introduced.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Wed, 20 Feb 2019 10:41:37 +0000 (11:41 +0100)]
wintun: Move exchange buffer in separate struct on heap
This allows buffer alignment and keeps it together with its meta-data.
Furthermore, the write buffer has been reduced - as long as we flush
after _every_ write, we don't need a 1MiB write buffer.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Tue, 19 Feb 2019 17:49:24 +0000 (18:49 +0100)]
wintun: Switch to dynamic packet sizes
Signed-off-by: Simon Rozman <simon@rozman.si>
Jason A. Donenfeld [Mon, 18 Feb 2019 03:44:41 +0000 (04:44 +0100)]
Change package path
Jason A. Donenfeld [Thu, 14 Feb 2019 09:59:01 +0000 (10:59 +0100)]
Bump dependencies for ARM ChaCha20
Simon Rozman [Fri, 8 Feb 2019 14:21:24 +0000 (15:21 +0100)]
wintun: Auto-calculate TUN exchange buffer size
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Feb 2019 13:31:05 +0000 (14:31 +0100)]
wintun: Simplify Read method()
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Feb 2019 07:55:23 +0000 (08:55 +0100)]
wintun: Make constants private and adopt Go recommended case
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Fri, 8 Feb 2019 07:48:35 +0000 (08:48 +0100)]
wintun: Check for user close in read loop regardless the load
Do the WaitForSingleObject() always to provide high-load responsiveness.
Reorder events so TUN_SIGNAL_CLOSE has priority over
TUN_SIGNAL_DATA_AVAIL, to provide high-load responsiveness at all.
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 23:19:56 +0000 (00:19 +0100)]
wintun: Adjust tunRWQueue.left member to match Wintun driver
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 22:45:11 +0000 (23:45 +0100)]
setupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailData
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 22:12:58 +0000 (23:12 +0100)]
setupapi: Merge SP_DRVINFO_DATA and DrvInfoData
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 22:00:52 +0000 (23:00 +0100)]
setupapi: Rename SP_REMOVEDEVICE_PARAMS to RemoveDeviceParams
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 21:37:14 +0000 (22:37 +0100)]
setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 21:35:03 +0000 (22:35 +0100)]
setupapi: Merge _SP_DEVINSTALL_PARAMS and DevInstallParams
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 21:23:03 +0000 (22:23 +0100)]
setupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailData
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 21:09:18 +0000 (22:09 +0100)]
setupapi: Rename SP_DEVINFO_DATA to DevInfoData
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 21:02:51 +0000 (22:02 +0100)]
wintun: Detect if a foreign interface with the same name exists
Signed-off-by: Simon Rozman <simon@rozman.si>
Simon Rozman [Thu, 7 Feb 2019 19:49:41 +0000 (20:49 +0100)]
wintun: Clean excessive setupapi.DevInfo.GetDeviceInfoListDetail() call
Signed-off-by: Simon Rozman <simon@rozman.si>