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
Jason A. Donenfeld
6b3b1c3b91
version: bump snapshot
2018-06-13 16:22:16 +02:00
Jason A. Donenfeld
6a5d0e2bcd
Support IPv6-less kernels
2018-06-12 01:32:46 +02:00
Jason A. Donenfeld
0ba551807f
Do not build tun device on ios
2018-06-09 03:31:17 +02:00
Jason A. Donenfeld
99d5aeeb27
Fix duplicated wording
2018-06-02 17:36:35 +02:00
Jason A. Donenfeld
a050431f26
Makefile: export PWD for OpenBSD's ksh(1)
...
Interestingly, ksh(1) on OpenBSD does not export PWD by default, and it
also has a notion of the "logical cwd" vs the "physical cwd", with the
latter being passed to chdir, but the former being stored in the
non-exported PWD and displayed to the user. This means that if you `cd`
into a directory that's comprised of symlinks, exec'd processes will see
the physical path. Observe:
# ksh
# mkdir a
# ln -s a b
# cd b
# pwd
/root/b
# ksh -c pwd
/root/a
The fact of separating physical and logical paths is not too uncommon
for shells (bash does it too), but not exporting PWD is very odd.
Since this is common behavior for many shells, libraries that return the
working directory will do something strange: they `stat(".")` and then
`stat(getenv("PWD"))`, and if these point to the same inode, they roll
with the value of `getenv("PWD")`, or otherwise fallback to asking the
kernel for the cwd.
Since PWD was not exported by ksh(1), Go's dep utility did not understand
it was operating inside of our faked GOPATH and became upset.
This patch works around the whole situation by simply exporting PWD
before executing dep.
2018-06-02 16:36:12 +02:00
Jason A. Donenfeld
0c976003c8
version: bump snapshot
2018-05-31 02:26:07 +02:00
Jason A. Donenfeld
955e89839f
Print version number in log
2018-05-30 01:09:18 +02:00
Jason A. Donenfeld
a4cd0216c0
Update deps
2018-05-28 01:39:37 +02:00
Jason A. Donenfeld
1d7845a600
Fix typo in timers
2018-05-27 22:55:15 +02:00
Jason A. Donenfeld
5079298ce2
Disable broadcast mode on *BSD
...
Keeping it on makes IPv6 problematic and confuses routing daemons.
2018-05-27 22:55:15 +02:00
Jason A. Donenfeld
fc3a7635e5
Disappointing anti-sticky experiment
2018-05-27 22:55:15 +02:00
Jason A. Donenfeld
2496cdd8e6
Fix tests
2018-05-24 19:58:16 +02:00
Jason A. Donenfeld
4365b4583f
Trick for being extra sensitive to route changes
2018-05-24 18:21:14 +02:00
Jason A. Donenfeld
bbf320c477
Back to sticky sockets on android
2018-05-24 17:53:00 +02:00
Jason A. Donenfeld
625d59da14
Do not build on Linux
2018-05-24 16:41:42 +02:00
Jason A. Donenfeld
2f2eca8947
Catch EINTR
2018-05-24 15:36:29 +02:00
Jason A. Donenfeld
66f6ca3e4a
Remove old makefile artifact
2018-05-24 03:13:46 +02:00
Jason A. Donenfeld
e6657638fc
version: bump snapshot
2018-05-24 02:25:51 +02:00
Jason A. Donenfeld
4a9de3218e
Add undocumented --version flag
2018-05-24 02:25:36 +02:00
Jason A. Donenfeld
28a167e828
Eye before ee except after see
2018-05-23 19:00:00 +02:00
Jason A. Donenfeld
99c6513d60
No zero sequence numbers
2018-05-23 18:30:55 +02:00
Jason A. Donenfeld
8a92a9109a
Don't cause a new fake gopath to call dep
2018-05-23 17:31:06 +02:00
Jason A. Donenfeld
0b647d1ca7
Infoleak ifnames and be more permissive
...
Listing interfaces is already permitted by the OS, so we allow this info
leak too.
2018-05-23 15:38:24 +02:00
Jason A. Donenfeld
588b9f01ae
Adopt GOPATH
...
GOPATH is annoying, but the Go community pushing me to adopt it is even
more annoying.
2018-05-23 05:18:13 +02:00
Jason A. Donenfeld
f70bd1fab3
Remove more windows cruft
2018-05-23 04:46:09 +02:00
Jason A. Donenfeld
40d5ff0c70
Cleanup
2018-05-23 03:58:27 +02:00
Jason A. Donenfeld
5a2228a5c9
Move replay into subpackage
2018-05-23 03:58:27 +02:00
Jason A. Donenfeld
0a63188afa
Move tun to subpackage
2018-05-23 03:58:27 +02:00
Jason A. Donenfeld
65a74f3175
Avoid sticky sockets on Android
...
The android policy routing system does insane things.
2018-05-22 23:22:23 +02:00
Jason A. Donenfeld
b4cef2524f
Fix integer conversions
2018-05-22 18:35:52 +02:00
Jason A. Donenfeld
7038de95e1
Bump dependencies for OpenBSD
2018-05-22 17:58:34 +02:00
Jason A. Donenfeld
82d12e85bb
Fix markdown
2018-05-22 16:47:15 +02:00
Jason A. Donenfeld
d6b694e161
Add OpenBSD tun driver support
2018-05-22 16:21:05 +02:00
Jason A. Donenfeld
794e494802
Fix code duplication
2018-05-22 14:59:29 +02:00
Jason A. Donenfeld
dd663a7ba4
Notes on FreeBSD limitations
2018-05-22 01:30:16 +02:00
Jason A. Donenfeld
8462c08cf2
Just in case darwin changes, we also shutdown
2018-05-22 01:27:29 +02:00