summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2019-03-20uapi: remove unhelpful log messagesJason A. Donenfeld
2019-03-21wintun: Use native Win32 API for I/OSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-19uapi: report endpoint errorJason A. Donenfeld
2019-03-18tun: windows: wintun does iocpJason A. Donenfeld
2019-03-13tun: windows: temporary hack for forcing MTUJason A. Donenfeld
2019-03-10wintun: Poll more oftenJason A. Donenfeld
2019-03-10uapi: make ipcerror conform to interfaceJason A. Donenfeld
2019-03-08wintun: Make errors more descriptiveSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-08wintun: Return correct reboot-req flag on CreateInterface() error tooSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-08wintun: Fix double-quoted strings escaping on outputSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-08wintun: Introduce SetupAPI enumerator and machineName constsSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-08Windows: Apply strict security descriptor on pipe serverOdd Stranne
Signed-off-by: Odd Stranne <odd@mullvad.net>
2019-03-08uapi: windows: work out pipe semanticsJason A. Donenfeld
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>
2019-03-07wintun: CleanupSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-07wintun: Refactor network registry key name generationSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-07wintun: Revise interface creation waitSimon Rozman
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>
2019-03-07receive: squelch tear down errorJason A. Donenfeld
2019-03-07tun: linux: work out netpoll trickJason A. Donenfeld
2019-03-04wintun: Resolve some of golint warningsSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-04Elaborate the failing step when forwarding errors on returnSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-04Simplify reading NetCfgInstanceId from registrySimon Rozman
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>
2019-03-04Unify interface-specific network registry key openSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-03-04tun: import mobile particularitiesJason A. Donenfeld
2019-03-04boundif: introduce API for socket bindingJason A. Donenfeld
2019-03-03global: begin modularizationJason A. Donenfeld
2019-03-01tun: windows: expose GUIDJason A. Donenfeld
2019-03-01tun: allow special methods in NativeTunJason A. Donenfeld
2019-02-27tun: linux: netpoll is broken for tun's epollJason A. Donenfeld
So this mostly reverts the switch to Sysconn for Linux. Issue: https://github.com/golang/go/issues/30426
2019-02-27tun: linux: netlink sock needs cleaning up but file will be gc'dJason A. Donenfeld
2019-02-27tun: use netpoll instead of rwcancelJason A. Donenfeld
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") }
2019-02-27tun: use sysconn instead of .Fd with Go 1.12Jason A. Donenfeld
2019-02-22Rearrange importsJason A. Donenfeld
2019-02-22device: send persistent keepalive when bringing up deviceJason A. Donenfeld
Reported-by: Marcelo Bello
2019-02-22wintun: Read/write packet size from/to exchange buffer directlySimon Rozman
Driver <-> user-space communication is local and using native endian. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-22wintun: Make two-step slicing a one stepSimon Rozman
Stop relying to Go compiler optimizations and calculate the end offset directly. Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-20wintun: Write exchange buffer increased back to 1MiBSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-20wintun: Migrate from unsafe buffer handling to encoding/binarySimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-20wintun: Adopt new packet data alignmentSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-20wintun: CleanupSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-20wintun: Add TUN device lockingSimon Rozman
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>
2019-02-20wintun: Move exchange buffer in separate struct on heapSimon Rozman
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>
2019-02-19wintun: Switch to dynamic packet sizesSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-18Change package pathJason A. Donenfeld
2019-02-14Bump dependencies for ARM ChaCha20Jason A. Donenfeld
2019-02-08wintun: Auto-calculate TUN exchange buffer sizeSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08wintun: Simplify Read method()Simon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08wintun: Make constants private and adopt Go recommended caseSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-08wintun: Check for user close in read loop regardless the loadSimon Rozman
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>
2019-02-08wintun: Adjust tunRWQueue.left member to match Wintun driverSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>
2019-02-07setupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailDataSimon Rozman
Signed-off-by: Simon Rozman <simon@rozman.si>