Jason A. Donenfeld
586112b5d7
conn: remove scope when sanity checking IP address format
2019-05-09 15:42:35 +02:00
Jason A. Donenfeld
b16b0e4cf7
mod: update deps
2019-05-03 09:37:29 +02:00
Jason A. Donenfeld
81ca08f1b3
setupapi: safer aliasing of slice types
2019-05-03 09:34:00 +02:00
Jason A. Donenfeld
2e988467c2
wintun: work around GetInterface staleness bug
2019-05-03 00:42:36 +02:00
Jason A. Donenfeld
46dbf54040
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.
2019-05-02 23:53:15 +02:00
Jason A. Donenfeld
247e14693a
wintun: try harder to open registry key
...
This sucks. Can we please find a deterministic way of doing this
instead?
2019-04-29 14:00:49 +02:00
Jason A. Donenfeld
3945a299ff
go.mod: use vendored winio
2019-04-29 08:09:38 +02:00
Jason A. Donenfeld
bb42ec7d18
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.
2019-04-23 18:00:23 +09:00
Jason A. Donenfeld
c7a26dfef3
setupapi: actually fix padding by rounding up to sizeof(void*)
2019-04-19 10:19:00 +09:00
Jason A. Donenfeld
d024393335
tun: darwin: write routeSocket variable in helper
...
Otherwise the race detector "complains".
2019-04-19 07:53:19 +09:00
Jason A. Donenfeld
d9078fe772
main: revise warnings
2019-04-19 07:48:09 +09:00
Jason A. Donenfeld
d3dd991e4e
device: send: check packet length before freeing element
2019-04-18 23:23:03 +09:00
Jason A. Donenfeld
e0a8c22aa6
windows: use proper constants from updated x/sys
2019-04-13 02:02:02 +02:00
Jason A. Donenfeld
0b77bf78cd
conn: linux: RTA_MARK has moved to x/sys
2019-04-13 02:01:20 +02:00
Jason A. Donenfeld
d50e390904
main_windows: use proper version constant
2019-04-09 10:45:40 +02:00
Jason A. Donenfeld
18fa270472
version: put version in right place
2019-04-09 10:39:48 +02:00
Jason A. Donenfeld
f156a53ff4
version: bump snapshot
2019-04-09 07:37:22 +02:00
Jason A. Donenfeld
e680008700
tun: windows: do not sleep after OPERATION_ABORTED
2019-04-09 07:36:03 +02:00
Jason A. Donenfeld
ac25702eaf
wintun: rename device using undocumented API that netsh.exe uses
2019-04-01 12:04:44 +02:00
Jason A. Donenfeld
92f8474832
wintun: add more retry loops
2019-04-01 09:07:43 +02:00
Jason A. Donenfeld
2e0ed4614a
tun: windows: cancel ongoing reads on closing and delete after close
...
This reverts commit 52ec440d79 and adds
some spice.
2019-03-26 16:14:32 +01:00
Jason A. Donenfeld
2fa80c0cb7
wintun: query for NetCfgInstanceId several times
2019-03-22 16:48:40 -06:00
Jason A. Donenfeld
52ec440d79
tun: windows: delete interface before deleting file handles
2019-03-22 16:45:58 -06:00
Jason A. Donenfeld
317d716d66
tun: windows: just open two file handles
2019-03-21 15:20:09 -06:00
Jason A. Donenfeld
6440f010ee
receive: implement flush semantics
2019-03-21 14:45:41 -06:00
Jason A. Donenfeld
49ea0c9b1a
tun: windows: add dummy overlapped events back
...
These seem basically wrong to me, but we get crashes without them.
2019-03-21 02:29:09 -06:00
Jason A. Donenfeld
ca59b60aa7
tun: windows: use new constants in sys
2019-03-20 23:42:30 -06:00
Jason A. Donenfeld
c050c6e60f
uapi: remove unhelpful log messages
2019-03-20 23:40:20 -06:00
Jason A. Donenfeld
2c51d6af48
uapi: report endpoint error
2019-03-19 00:34:04 -06:00
Jason A. Donenfeld
03f2e2614a
tun: windows: wintun does iocp
2019-03-18 02:42:45 -06:00
Jason A. Donenfeld
b0e0ab308d
tun: windows: temporary hack for forcing MTU
2019-03-13 02:52:32 -06:00
Jason A. Donenfeld
66fb5caf02
wintun: Poll more often
2019-03-10 03:47:54 +01:00
Jason A. Donenfeld
3dd9a0535f
uapi: make ipcerror conform to interface
2019-03-10 02:49:44 +01:00
Jason A. Donenfeld
5c7cc256e3
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 <[email protected] >
2019-03-08 01:40:54 +01:00
Jason A. Donenfeld
26af6c4651
receive: squelch tear down error
2019-03-07 02:03:48 +01:00
Jason A. Donenfeld
92f72f5aa6
tun: linux: work out netpoll trick
2019-03-07 01:51:41 +01:00
Jason A. Donenfeld
68f0721c6a
tun: import mobile particularities
2019-03-04 16:37:11 +01:00
Jason A. Donenfeld
b8e85267cf
boundif: introduce API for socket binding
2019-03-04 16:37:11 +01:00
Jason A. Donenfeld
69f0fe67b6
global: begin modularization
2019-03-03 05:00:40 +01:00
Jason A. Donenfeld
d435be35ca
tun: windows: expose GUID
2019-03-01 00:11:12 +01:00
Jason A. Donenfeld
967d1a0f3d
tun: allow special methods in NativeTun
2019-03-01 00:05:57 +01:00
Jason A. Donenfeld
88ff67fb6f
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
2019-02-27 04:38:26 +01:00
Jason A. Donenfeld
971be13e77
tun: linux: netlink sock needs cleaning up but file will be gc'd
2019-02-27 04:11:41 +01:00
Jason A. Donenfeld
366cbd11a4
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")
}
2019-02-27 01:52:55 +01:00
Jason A. Donenfeld
ab0f442daf
tun: use sysconn instead of .Fd with Go 1.12
2019-02-27 01:34:11 +01:00
Jason A. Donenfeld
66524c1f7e
Rearrange imports
2019-02-22 20:59:43 +01:00
Jason A. Donenfeld
6e4460ae65
device: send persistent keepalive when bringing up device
...
Reported-by: Marcelo Bello
2019-02-22 19:33:28 +01:00
Jason A. Donenfeld
42c6d0e261
Change package path
2019-02-18 05:11:39 +01:00
Jason A. Donenfeld
f7170e5de2
Bump dependencies for ARM ChaCha20
2019-02-14 10:59:54 +01:00
Jason A. Donenfeld
c4b43e35a7
wintun: add FlushInterface stub
2019-02-07 18:24:28 +01:00
Jason A. Donenfeld
2efafecab5
main_windows: Get iface name from argument
2019-02-07 15:44:07 +01:00
Jason A. Donenfeld
fac1fbcd72
wintun: Compare values of GUID, not pointers, when removing
2019-02-07 04:49:15 +01:00
Jason A. Donenfeld
52aa00f3ba
main_windows: Catch more exit events
2019-02-07 04:42:35 +01:00
Jason A. Donenfeld
ea59177f1c
wintun: Introduce new package for obscuring Windows bits
2019-02-07 04:39:59 +01:00
Jason A. Donenfeld
306d08e692
tun_windows: Style
2019-02-07 04:08:05 +01:00
Jason A. Donenfeld
3b7a4fa3ef
setupapi: Lower case params
2019-02-07 03:46:31 +01:00
Jason A. Donenfeld
223685875f
setupapi: Do not export the toGo/toWindows functions
2019-02-07 02:56:31 +01:00
Jason A. Donenfeld
652158ec3c
setupapi: Pass pointers instead of values
2019-02-07 02:37:19 +01:00
Jason A. Donenfeld
c599bf9497
Fix up errors and paths
2019-02-05 22:06:25 +09:00
Jason A. Donenfeld
f7f63765d1
conn: close ipv4 socket when ipv6 socket fails
2019-02-05 21:55:33 +09:00
Jason A. Donenfeld
6f76edd045
Import windows scafolding
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
3af9aa88a3
noise: store clamped key instead of raw key
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
a5ca02d79a
tai64n: whiten nano seconds
...
Avoid being too precise of a time oracle.
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
2b7562abbb
uapi: Simpler function signature
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
89d2c5ed7a
Extend structs rather than embed, when possible
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
dff424baf8
Update copyright
2019-02-05 12:59:42 +01:00
Jason A. Donenfeld
6e61c369e8
Properly bubble up setsockopt error from closure
2018-12-25 22:56:36 +01:00
Jason A. Donenfeld
8fde8334dc
version: bump snapshot
2018-12-22 17:34:23 +01:00
Jason A. Donenfeld
a8326ae753
Make error messages consistent
2018-12-19 00:35:53 +01:00
Jason A. Donenfeld
05cc0c8298
Freebsd is finally normal in sys/unix
2018-12-11 18:33:13 +01:00
Jason A. Donenfeld
c967f15e44
Separate out mark setting for Windows
2018-12-11 18:29:46 +01:00
Jason A. Donenfeld
5ace0fdfe2
Use upstream's xchacha20poly1305
2018-12-10 04:23:17 +01:00
Jason A. Donenfeld
849fa400e9
Update go x/ libraries
...
Android 9's Bionic disallows inotify_init with seccomp, so we want the
latest unix change, and while we're at it, we update the others too.
Reported-by: Berk D. Demir <[email protected] >
Go CL: https://go-review.googlesource.com/c/sys/+/153318
Fixes: https://lists.zx2c4.com/pipermail/wireguard/2018-December/003642.html
2018-12-10 04:04:19 +01:00
Jason A. Donenfeld
651744561e
tun: remove nonblock hack for linux
...
This is no longer necessary and actually breaks things
Reported-by: Chris Branch <[email protected] >
2018-12-06 17:17:51 +01:00
Jason A. Donenfeld
4fd55daafe
tai64n: use proper nanoseconds offset
...
The code before was obviously wrong.
Reported-by: Vlad Krasnov <[email protected] >
2018-11-08 03:58:01 +01:00
Jason A. Donenfeld
276bf973e8
Use darwin tun on ios
2018-11-06 16:24:35 +01:00
Jason A. Donenfeld
c37c4ece9e
uapi: typo
2018-11-05 05:46:27 +01:00
Jason A. Donenfeld
b803276061
receive: make started status uniform
2018-11-01 19:54:25 +01:00
Jason A. Donenfeld
8be1fc9c00
send: do not unlock already freed object
2018-10-18 18:15:24 +02:00
Jason A. Donenfeld
738d027f0b
version: bump snapshot
2018-10-18 02:38:29 +02:00
Jason A. Donenfeld
60848b9c72
Makefile: rename default to all
2018-10-17 21:45:16 +02:00
Jason A. Donenfeld
2e772194cf
tun: only call .Fd() once
...
Doing so tends to make the tunnel blocking, so we only retrieve it once
before we call SetNonblock, and then cache the result.
2018-10-17 21:31:42 +02:00
Jason A. Donenfeld
85b2378a07
Use go modules always
2018-10-12 01:45:33 +02:00
Jason A. Donenfeld
fddb949002
Do not build if nothing to do
2018-10-12 01:12:56 +02:00
Jason A. Donenfeld
5d6083df7e
Switch to go modules
2018-10-09 18:13:56 +02:00
Jason A. Donenfeld
b41922e5c8
version: bump snapshot
2018-10-01 17:58:31 +02:00
Jason A. Donenfeld
dbb72402f2
Adding missing queueconstants file
2018-10-01 16:11:31 +02:00
Jason A. Donenfeld
70bcf9ecb8
Make it easy to restrict queue sizes more
2018-09-25 02:31:02 +02:00
Jason A. Donenfeld
ebc7541953
Fix shutdown races
2018-09-24 01:52:02 +02:00
Jason A. Donenfeld
833597b585
More pooling
2018-09-24 00:37:43 +02:00
Jason A. Donenfeld
cf81a28dd3
Fixup buffer freeing
2018-09-22 05:43:03 +02:00
Jason A. Donenfeld
942abf948a
send: more precise padding calculation
2018-09-16 23:42:31 +02:00
Jason A. Donenfeld
47d1140361
device: preallocated buffers scheme
...
Not useful now but quite possibly later.
2018-09-16 23:10:19 +02:00
Jason A. Donenfeld
39d6e4f2f1
Change queueing drop order and fix memory leaks
...
If the queues are full, we drop the present packet, which is better for
network traffic flow. Also, we try to fix up the memory leaks with not
putting buffers from our shared pool.
2018-09-16 21:50:58 +02:00
Jason A. Donenfeld
1c02557013
send: use accessor function for buffer pool
2018-09-16 18:49:19 +02:00
Jason A. Donenfeld
5be541d147
global: fix up copyright headers
2018-09-16 18:49:19 +02:00
Jason A. Donenfeld
063becdc73
uapi: insert peer version placeholder
...
While we don't want people to ever use old protocols, people will
complain if the API "changes", so explicitly make the unset protocol
mean the latest, and add a dummy mechanism of specifying the protocol on
a per-peer basis, which we hope nobody actually ever uses.
2018-09-02 23:04:47 -06:00
Jason A. Donenfeld
15da869b31
Fix duplicate copyright line
2018-07-30 05:14:17 +02:00
Jason A. Donenfeld
3ad3e83c7a
uapi: allow overriding socket directory at compile time
2018-07-24 14:32:35 +02:00
Jason A. Donenfeld
2e13b7b0fb
send: better debug message for failed data packet
2018-07-16 16:05:36 +02:00