Commit graph

245 commits

Author SHA1 Message Date
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
Mathias Hall-Andersen ac9912345b Fixed read from closed channel
A premature waitgroup .Done resulted in reading from closed channel.
This caused a nil-pointer deref & crash.

Added additional debugging when closing routines.
2018-04-18 20:29:48 +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
Mathias Hall-Andersen 6cecaf3157 Begin work on full device<->device unit-test
To simulate a full interaction between two WireGuard
instances without networking, using dummy instances of the interfaces
2018-03-08 16:44:46 +01: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
Mathias Hall-Andersen 9de17e6c9c Seperated fwmark update code into function 2018-02-18 20:49:03 +01:00
Jason A. Donenfeld 8f1d1b8c54 MPLv2 for App Store 2018-02-13 19:43:47 +01:00
Dominik Süß fa37039c3b Reimplemented bind_rtmgrp in pure Go
Getting rid of the Cgo dependency for listing on netlink.

Ported original patch from "syscall" to "golang.org/x/sys/unix".

Signed-off-by: Dominik Süß <dominik.suess@outlook.at>
Co-Authored-By: Mathias Hall-Andersen <mathias@hall-andersen.dk>
2018-02-13 16:43:07 +01:00
Jason A. Donenfeld ff8f3a412e Use relative imports 2018-02-12 23:49:41 +01:00
Mathias Hall-Andersen ea4ea6f933 Revert "Don't use modules"
This reverts commit bffe99aead.
2018-02-12 22:29:11 +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
Mathias Hall-Andersen 77285c99aa Moved test-processes to background 2018-02-11 23:31:53 +01:00
Mathias Hall-Andersen 6cba91999c TUN status hack was causing spam during shutdown 2018-02-11 23:26:54 +01:00
Mathias Hall-Andersen 04ded4c631 Added missing mutex acquisition 2018-02-11 23:07:07 +01:00
Mathias Hall-Andersen 8bdadaae59 Removed exported methods from ratelimiter package 2018-02-11 23:01:55 +01:00
Mathias Hall-Andersen 5f0a91a127 Moved ratelimiter to internal package 2018-02-11 22:53:39 +01:00
Mathias Hall-Andersen 1cf23c0005 Moved tai64n into sub-package 2018-02-11 19:25:33 +01:00
Mathias Hall-Andersen 743364f647 Fixed tabs 2018-02-11 19:02:50 +01:00
Mathias Hall-Andersen 73cb1a1155 Reverted event changes
This feature was not needed for Android, upon further inspection.
2018-02-11 18:55:30 +01:00
Mathias Hall-Andersen b461343171 Started migration to sub-packages 2018-02-09 18:56:00 +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
Mathias Hall-Andersen ceccd39420 Work on logging format 2018-02-04 19:18:44 +01:00
Mathias Hall-Andersen 283e7117cf Merge branch 'master' into timer-teardown 2018-02-04 16:48:03 +01:00
Mathias Hall-Andersen 9c5083bd19 Removed debugging locks 2018-02-04 16:46:24 +01:00
Mathias Hall-Andersen a0f54cbe5a Align with go library layout 2018-02-04 16:08:26 +01:00
Mathias Hall-Andersen 5871ec04de Fixed tests 2018-02-02 20:45:25 +01:00
Mathias Hall-Andersen 4f97b52ea6 Clear cryptographic state when interface down
Attempts to clear the cryptographic state for every
peer when the device goes down.
2018-02-02 17:24:29 +01:00
Mathias Hall-Andersen 029410b118 Rework of entire locking system
Locking on the Device instance is now much more fined-grained,
seperating out the fields into "resources" st. most common interactions
only require a small number.
2018-02-02 16:40:14 +01:00
Mathias Hall-Andersen 1e42b14022 Merge branch 'timer-teardown' of git.zx2c4.com:wireguard-go into timer-teardown 2018-02-01 11:20:36 +01:00
Mathias Hall-Andersen a57c790e36 Added binary to .gitignore 2018-01-31 10:11:36 +01:00
Mathias Hall-Andersen f73d2fb2d9 Added initial version of peer teardown
There is a double lock issue with device.Close which has yet to be
resolved.
2018-01-26 22:52:32 +01:00
Mathias Hall-Andersen 068d932f2c Fixed potential DoS issue 2018-01-16 14:57:12 +01:00
Mathias Hall-Andersen 1dd590b91b Work on timer teardown + bug fixes
Added waitgroups to peer struct for routine
start / stop synchronisation
2018-01-13 09:00:37 +01:00
Mathias Hall-Andersen 5f01086f19 Fixed fwmark update without device status change
An update of the fwmark was missing,
when the device was not bought up after the change.
2018-01-09 17:26:18 +01:00
Mathias Hall-Andersen 9360bac632 Revert "Peer timer teardown"
This reverts commit d73f960aab.

Problems with deadlocking arises due to orphaned packets in per-peer
queues. Additional work on this issue continues in seperate branch.
2018-01-04 14:24:14 +01:00
Mathias Hall-Andersen d73f960aab Peer timer teardown 2017-12-29 17:42:09 +01:00
Mathias Hall-Andersen 996c7c4d8a Removed IFF_NO_PI from TUN linux
This change was needed for the Linux TUN status hack
to work properly (not increment the error counter).

This commit also updates the TUN interface to allow for
the construction / removal of the TUN info headers in-place.
2017-12-04 21:39:06 +01:00
Mathias Hall-Andersen 9fef0ca2fb Removed profiler code 2017-12-02 00:00:45 +01:00
Mathias Hall-Andersen eaca1ee1f7 More consistent use of signal struct 2017-12-01 23:37:26 +01:00
Mathias Hall-Andersen cb09125dc4 Fixed receive path infinite loop 2017-12-01 00:03:06 +01:00
Mathias Hall-Andersen cd369cde45 Added missing exit codes 2017-11-30 23:30:29 +01:00
Mathias Hall-Andersen 02ce67294c Refactor timers.go 2017-11-30 23:22:40 +01:00