Commit Graph
100 Commits
Author SHA1 Message Date
Jason A. Donenfeld 6307bfcdf4 Close hack listener before closing channel 2018-05-21 03:31:46 +02:00
Jason A. Donenfeld e28d70f5b2 ratelimiter: do not run GC with nothing to do 2018-05-21 03:20:18 +02:00
Jason A. Donenfeld 84c5357cf3 Reasonable punctuation given the spacing 2018-05-21 02:50:39 +02:00
Jason A. Donenfeld acb5481246 Fix data races in timers 2018-05-20 06:50:07 +02:00
Jason A. Donenfeld 18f43705ec Fix race with closing event channel
There's still a tiny race on Linux, since the tun channel is written to
from two places.
2018-05-20 06:38:39 +02:00
Jason A. Donenfeld 058cedcf66 Style 2018-05-20 06:29:46 +02:00
Jason A. Donenfeld c5fa3de24c Remove unused mtu variable 2018-05-20 06:29:21 +02:00
Jason A. Donenfeld 1068d6b92b Give bind its own wait group
In a waitgroup, all waits must come after all adds
2018-05-20 06:29:21 +02:00
Jason A. Donenfeld 5e924e5407 Avoid deadlock when the mutex isn't required, since these are atomics
Maybe this fixes the "double lock issue" in
f73d2fb2d96bc3fbc8bc4cce452e3c19689de01e?
2018-05-20 06:29:21 +02:00
Jason A. Donenfeld b290cf05e3 Use proper status listener on Darwin 2018-05-20 06:29:21 +02:00
Jason A. Donenfeld b95a4c61a5 Reduce the hack listener to once a second 2018-05-20 04:03:11 +02:00
Jason A. Donenfeld a5b3340e5b Fix race in netlink peer correlator 2018-05-20 03:37:42 +02:00
Jason A. Donenfeld 7c21a3de0a Fix race in lock pending 2018-05-20 03:31:27 +02:00
Jason A. Donenfeld 0a68c1ab17 Fix race in stats 2018-05-20 03:26:46 +02:00
Jason A. Donenfeld e04f9543c0 Fix race in packetInNonceQueueIsAwaitingKey 2018-05-20 03:24:14 +02:00
Jason A. Donenfeld fa003b6933 Discourage building for Linux 2018-05-20 03:19:03 +02:00
Jason A. Donenfeld 75cdc5986a Revert "Temporary work around. Please revert me"
This reverts commit 4312a7c70a.
2018-05-19 02:40:22 +02:00
Jason A. Donenfeld 5a267f0b8c timers: no need to clear keepalive in persistent keepalive
We do this after sending the keepalive anyway.

This is something of a regression, though, since before we'd cancel and
then send, but now we send and then cancel, so it introduces a potential
race, but hopefully that isn't too big of a deal.

Kernel module commit a24b3e6e15ae1ea1291666e5da910caf43eedbaf
2018-05-19 02:40:22 +02:00
Jason A. Donenfeld 870734ab5e timers: clear send_keepalive timer on sending handshake response
We reorganize this into also doing so on sending keepalives itself,
which means the state machine is much more consistent, even if this was
already implied.

Kernel module commit 30290ef1d2581a3e6ee8ffcdb05d580cfba976be
2018-05-19 02:40:22 +02:00
Jason A. Donenfeld 125976edce Avoid using v6-mapped-v4 2018-05-18 05:02:35 +02:00
Jason A. Donenfeld 52d797ce1a Style 2018-05-18 04:51:02 +02:00
Jason A. Donenfeld 711f929879 Fill out readme 2018-05-17 16:55:45 +02:00
Jason A. Donenfeld 846d721dfd Finer-grained start-stop synchronization 2018-05-16 22:20:15 +02:00
Jason A. Donenfeld 23eca94508 Fix dir permissions 2018-05-15 19:57:43 +02:00
Jason A. Donenfeld 4312a7c70a Temporary work around. Please revert me 2018-05-15 19:56:06 +02:00
Jason A. Donenfeld 207fd644e8 Lock timers on modification 2018-05-15 18:44:00 +02:00
Jason A. Donenfeld ab02aacdd6 Avoid vendoring tooling as much as possible 2018-05-15 15:27:46 +02:00
Jason A. Donenfeld 0e4ebfa194 Add vendoring for Homebrew 2018-05-15 14:49:52 +02:00
Jason A. Donenfeld cf161f270e Do not send keepalive if closed 2018-05-15 13:29:52 +02:00
Jason A. Donenfeld 27091c3284 Fix refactoring mistakes 2018-05-15 06:28:42 +02:00
Jason A. Donenfeld 08d7602dc3 Improve makefile 2018-05-15 02:16:51 +02:00
Jason A. Donenfeld 115a2e3946 Use /dev/null as place holder 2018-05-14 20:06:33 +02:00
Jason A. Donenfeld 28c7eb4335 Print utun name on darwin 2018-05-14 19:33:35 +02:00
Jason A. Donenfeld 7a1a537f43 Mask IPs when showing from trie
Otherwise intermediate nodes that get collapsed to real nodes will
display the wrong value.
2018-05-14 17:57:58 +02:00
Jason A. Donenfeld a62c770a99 Ugly hack to suppress warning on backgrounded process 2018-05-14 16:01:58 +02:00
Jason A. Donenfeld 09235d48d8 Better common bits function 2018-05-14 15:49:20 +02:00
Jason A. Donenfeld 7f1c9d1cc2 Fix noise test 2018-05-14 14:47:31 +02:00
Jason A. Donenfeld 021724a535 Cancelable netlink writes and better response correlation 2018-05-14 14:18:26 +02:00
Jason A. Donenfeld 795f76cffa Netlink sockets can't be shutdown 2018-05-14 14:08:03 +02:00
Jason A. Donenfeld 2dfd4e7d8c Cleanup socket file 2018-05-14 13:05:37 +02:00
Jason A. Donenfeld 355e9bd619 Clean more 2018-05-14 12:27:29 +02:00
Jason A. Donenfeld 8b30278ce6 No more finalizer for rwcancel 2018-05-14 06:10:08 +02:00
Jason A. Donenfeld 17262dfd62 No need for padding any more 2018-05-14 04:36:20 +02:00
Jason A. Donenfeld 25df2e6942 Shorthand for empty channels 2018-05-14 04:19:25 +02:00
Jason A. Donenfeld b76ab82539 Allow go routine to shutdown in darwin tun 2018-05-14 04:14:57 +02:00
Jason A. Donenfeld 5f5503afa8 Add rwcancelation to darwin 2018-05-14 04:02:59 +02:00
Jason A. Donenfeld f738c45a68 Smoother netlink shutdown 2018-05-14 03:44:57 +02:00
Jason A. Donenfeld c1e097d6d0 Optional logging even in background 2018-05-14 03:38:06 +02:00
Jason A. Donenfeld e75d2d4496 Fix dummy additions 2018-05-14 03:29:21 +02:00
Jason A. Donenfeld 0fb14232fa Look up route for every peer 2018-05-14 03:26:38 +02:00
Jason A. Donenfeld 659106bd6d Ensure go routines can exit 2018-05-14 02:14:33 +02:00
Jason A. Donenfeld 29b0453cf1 Send event on erroring kqueue 2018-05-14 00:48:59 +02:00
Jason A. Donenfeld 7e10ebe101 Introduce rwcancel 2018-05-14 00:30:52 +02:00
Jason A. Donenfeld e21ea58db3 Prettier abbreviation 2018-05-13 23:27:28 +02:00
Jason A. Donenfeld b56af1829d More refactoring 2018-05-13 23:20:13 +02:00
Jason A. Donenfeld 729773fdf3 More odds and ends 2018-05-13 19:52:13 +02:00
Jason A. Donenfeld 680a57faae Fix up tests 2018-05-13 19:35:11 +02:00
Jason A. Donenfeld 2326d6a4d7 Odds and ends 2018-05-13 19:34:28 +02:00
Jason A. Donenfeld e94185681f Cleanup ratelimiter 2018-05-13 18:42:06 +02:00
Jason A. Donenfeld 2c27ab205c Rework index hashtable 2018-05-13 18:26:09 +02:00
Jason A. Donenfeld 233f079a94 Rewrite timers and related state machines 2018-05-10 16:08:03 +02:00
Jason A. Donenfeld c29428b075 Reorder stopping messages so that logs are coherent 2018-05-05 06:09:30 +02:00
Jason A. Donenfeld a46401bbb1 More robust solution to close deadlock 2018-05-05 06:00:38 +02:00
Jason A. Donenfeld 09a9bc2899 Fix infinite loop in exit routine 2018-05-05 05:33:29 +02:00
Jason A. Donenfeld beab52258a Merge branch 'master' of ssh://git.zx2c4.com/wireguard-go 2018-05-05 04:20:16 +02:00
Jason A. Donenfeld 36659454ce tun: simplify and combine creation logic on Linux 2018-05-05 03:40:52 +02:00
Jason A. Donenfeld 142e53f698 Style 2018-05-05 02:48:21 +02:00
Jason A. Donenfeld 4a177de09c tun: account for null termination on Linux 2018-05-05 02:47:35 +02:00
Jason A. Donenfeld e1de0f229a uapi: use kqueue for sock deletion on darwin 2018-05-04 21:51:55 +02:00
Jason A. Donenfeld ac898bb35a tun: print automatically assigned interface name to stdout
This way scripts know what process they just started.
2018-05-04 21:20:19 +02:00
Jason A. Donenfeld de7ecc571b tun: allow darwin to auto assign names 2018-05-04 21:11:51 +02:00
Jason A. Donenfeld 0f322f83f5 warning: put into main 2018-05-04 19:50:08 +02:00
Jason A. Donenfeld a040786645 global: Add SPDX tags and copyright header
Mathias should probably add his copyright headers to each file too.
2018-05-03 15:06:25 +02:00
Jason A. Donenfeld 209dd22ea0 Daemonize with environment variable 2018-05-03 14:55:10 +02:00
Jason A. Donenfeld 258a9223b9 Start to dust off Darwin 2018-05-03 14:55:10 +02:00
Jason A. Donenfeld 168ef61a63 Add missing locks and fix debug output, and try to flush queues
Flushing queues on exit is sort of a partial solution, but this could be
better. Really what we want is for no more packets to be enqueued after
isUp is set to false.
2018-05-01 17:46:28 +02:00
Jason A. Donenfeld b34604245e Clear src cache if route changes to new ifindex 2018-04-27 05:41:07 +02:00
Jason A. Donenfeld 92261b770f Fix error handling and cleanup of netlink listener 2018-04-27 02:47:31 +02:00
Jason A. Donenfeld 0715bdf353 Fix wrong debug messages 2018-04-20 07:13:40 +02:00
Jason A. Donenfeld 5ba84696e2 Rework sticky sockets 2018-04-20 06:51:28 +02:00
Jason A. Donenfeld f5c256affd Check for correct first nibble
The code before assumed that the flow label was always zero.
2018-04-20 06:51:28 +02:00
Jason A. Donenfeld 4973ea0c9e Signal using select and a pipe for bringing down TUN reader
Waiting on resolution of these to fix in better way:
- https://github.com/golang/go/issues/22939
- https://github.com/golang/go/issues/24331
2018-04-20 04:16:34 +02:00
Jason A. Donenfeld 676bb91434 We can determine the interface name ourselves 2018-04-19 16:00:20 +02:00
Jason A. Donenfeld ab875491c0 Do not hard code MTU default 2018-04-19 15:54:51 +02:00
Jason A. Donenfeld 26a56a652e Allow determining name 2018-04-18 16:42:30 +02:00
Jason A. Donenfeld 0b940a7568 Use socketcall on x86 2018-04-18 10:17:04 +02:00
Jason A. Donenfeld eb6728400b Use simple 16-bit integer for persistent keepalive
Races for this aren't a huge problem.
2018-04-18 07:24:33 +02:00
Jason A. Donenfeld 099219be2a Align 64-bit atomics
64-bit varibles that are accessed using the Go atomic functions must be
8-byte aligned on 32-bit platforms. Otherwise there are crashes.
2018-04-18 06:54:21 +02:00
Jason A. Donenfeld fd248c6cb1 Support nopi mode 2018-02-28 19:58:51 +01:00
Jason A. Donenfeld 09de7d1342 Close tun fd when bringing down tunnel 2018-02-18 22:54:33 +01:00
Jason A. Donenfeld 519c5d200a Fix timer typo 2018-02-18 20:58:43 +01:00
Jason A. Donenfeld 8f1d1b8c54 MPLv2 for App Store 2018-02-13 19:43:47 +01:00
Jason A. Donenfeld ff8f3a412e Use relative imports 2018-02-12 23:49:41 +01:00
Jason A. Donenfeld bffe99aead Don't use modules
Feel free to revert this if you have a strong feeling about it. But so
far as I can see, it adds a lot of complexity for basically no upsides.
2018-02-12 20:13:03 +01:00
Jason A. Donenfeld 51a6001bb9 Go treats underscores specially
In case there's ever a platform called helpers or protocol, we don't
want to be doing this.
2018-02-07 18:59:41 +01:00
Jason A. Donenfeld 32d8932d1b Sleep to close fd 2017-09-26 15:24:18 +02:00
Jason A. Donenfeld 6fa65bded4 Clean up error handling of listen port 2017-09-26 15:15:27 +02:00
Jason A. Donenfeld 012e7b9d33 Simplified xplatform spec 2017-09-26 14:26:50 +02:00
Jason A. Donenfeld c545d63bb9 Fix up fwmark handling 2017-09-21 03:10:03 +02:00
Jason A. Donenfeld 0ade48cb82 Makefile: cleanup a bit and add cloc
Signed-off-by: Jason A. Donenfeld <[email protected]>
2017-08-01 17:09:34 +02:00