Commit Graph
100 Commits
Author SHA1 Message Date
Mathias Hall-Andersen 4d9f3a2f53 Merge branch 'master' of ssh://git.zx2c4.com/wireguard-go 2018-05-05 02:47:59 +02:00
Mathias Hall-Andersen edbce6b400 Merge branch 'master' of ssh://git.zx2c4.com/wireguard-go 2018-05-05 02:23:03 +02:00
Mathias Hall-Andersen 6db41d5a26 Initial version of migration to new event model
- Begin move away from global timer state.
- Made logging format more consistent
2018-05-05 02:20:52 +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
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
Mathias Hall-Andersen 9de17e6c9c Seperated fwmark update code into function 2018-02-18 20:49:03 +01:00
Mathias Hall-Andersen ea4ea6f933 Revert "Don't use modules"
This reverts commit bffe99aead.
2018-02-12 22:29:11 +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
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
Mathias Hall-Andersen 479a6f240e Fixed typos 2017-11-29 21:12:09 +01:00
Mathias Hall-Andersen 471f7ff08e Added cross namespace TUN status detection 2017-11-29 18:46:31 +01:00
Mathias Hall-Andersen af464cff00 Better naming of bind helpers 2017-11-19 13:35:17 +01:00
Mathias Hall-Andersen b5ae42349c Merge branch 'source-caching' 2017-11-19 13:19:07 +01:00
Mathias Hall-Andersen 9ebab57c41 Implemented missing methods for Bind and Endpoint 2017-11-19 13:14:15 +01:00
Mathias Hall-Andersen a79fdc13a2 Begin generic Bind implementation 2017-11-19 00:21:58 +01:00
Mathias Hall-Andersen d10126f883 Moved endpoint into interface and simplified peer 2017-11-18 23:34:02 +01:00
Mathias Hall-Andersen fa399a91d5 Ported remaining netns.sh
- Ported remaining netns.sh tests
- Begin work on generic implementation of bind interface
2017-11-17 17:25:58 +01:00
Mathias Hall-Andersen e1227d3af4 Allows passing UAPI fd to service 2017-11-17 14:36:08 +01:00
Mathias Hall-Andersen 88801529fd Moved TUN device creation to pre-fork 2017-11-14 18:26:28 +01:00
Mathias Hall-Andersen 69fe86edf0 Initial working source caching 2017-11-14 16:27:53 +01:00
Mathias Hall-Andersen 566269275e Fixed blocking reader on closed socket 2017-11-11 23:26:44 +01:00
Mathias Hall-Andersen 892276aa64 Fixed port endianness 2017-11-11 15:43:55 +01:00
Mathias Hall-Andersen 0485c34c8e Fixed message header length in conn_linux 2017-10-27 10:43:37 +02:00
Mathias Hall-Andersen fd6f2e1f55 Fixed timer issue when failing to send handshake
+ Identified send4 issue
2017-10-17 16:50:23 +02:00
Mathias Hall-Andersen e86d03dca2 Initial implementation of source caching
Yet untested.
2017-10-16 21:33:47 +02:00
Mathias Hall-Andersen a72b0f7ae5 Added new UDPBind interface 2017-10-08 22:03:32 +02:00
Mathias Hall-Andersen 2d856045a0 Begin incorporating new src cache into receive 2017-10-07 22:35:23 +02:00
Mathias Hall-Andersen c70f0c5da2 Definition of platform specific socket bind 2017-10-06 22:56:01 +02:00
Mathias Hall-Andersen eefa47b0f9 Begin work on source address caching (linux) 2017-09-24 21:35:25 +02:00
Mathias Hall-Andersen 47a21c8bb0 Added last_minute_handshake_guard
- Added last_minute_handshake_guard and reverted keypair changes.
- Added comment explaining the state of Go in releation to handling
  cryptographic state in memory.
- Decreased logging level of netsh test
2017-09-20 09:26:08 +02:00
Mathias Hall-Andersen f212795e51 Improved readability of send/receive code 2017-09-09 15:03:01 +02:00
Mathias Hall-Andersen 89d0045214 Fixed TUN interface implementation os OS X 2017-09-03 18:10:06 +02:00
Mathias Hall-Andersen c24b883c01 Fixed KDF tests 2017-09-01 14:31:57 +02:00
Mathias Hall-Andersen 0294a5c0dd Improved handling of key-material 2017-09-01 14:21:53 +02:00
Mathias Hall-Andersen 239d582cb2 Renamed config.go to follow general naming pattern 2017-08-28 18:30:11 +02:00
Mathias Hall-Andersen 6f5ef153c3 Added code from windows branch 2017-08-27 15:41:00 +02:00
Mathias Hall-Andersen eafa3df606 Added fwmark code 2017-08-25 14:53:23 +02:00
Mathias Hall-Andersen 4986cfe78b Add support for fwmark on linux 2017-08-22 17:22:45 +02:00
Mathias Hall-Andersen c6d03ef17f Update MTU based on netlink messages (linux) 2017-08-22 14:57:32 +02:00
Mathias Hall-Andersen 04640eb629 Added missing IF index check 2017-08-17 12:58:18 +02:00
Mathias Hall-Andersen 24f9394f64 Detects interface status on linux 2017-08-17 00:25:39 +02:00
Mathias Hall-Andersen 754ed08bf4 Improved test script 2017-08-14 17:14:44 +02:00
Mathias Hall-Andersen 12e8db2066 Improved cookie/mac computation code 2017-08-14 17:09:25 +02:00
Mathias Hall-Andersen a4eff12d7f Improved receive.go
- Fixed configuration listen-port semantics
- Improved receive.go code for updating listen port
- Updated under load detection, how follows the kernel space implementation
- Fixed trie bug accidentally introduced in last commit
- Added interface name to log (format still subject to change)
- Can now configure the logging level using the LOG_LEVEL variable
- Begin porting netsh.sh tests
- A number of smaller changes
2017-08-11 16:18:20 +02:00
Mathias Hall-Andersen cba1d6585a Number of fixes in response to code review
This version cannot complete a handshake.
The program will panic upon receiving any message on the UDP socket.
2017-08-07 15:25:04 +02:00
Mathias Hall-Andersen 8c34c4cbb3 First set of code review patches 2017-08-04 16:15:53 +02:00
Mathias Hall-Andersen 22c83f4b8d Merge branch 'master' of git.zx2c4.com:wireguard-go 2017-08-02 15:32:12 +02:00
Mathias Hall-Andersen a70c44a9f6 Create /var/run/wireguard if non-existent 2017-08-02 15:30:57 +02:00
Mathias Hall-Andersen 91c1822473 Remove stale unix socket 2017-08-01 12:45:11 +02:00
Mathias Hall-Andersen b03a6ab1b1 Close UAPI socket before exit 2017-08-01 12:15:20 +02:00
Mathias Hall-Andersen d7a49b8b8c Verify source address 2017-07-31 22:26:55 +02:00
Mathias Hall-Andersen 1fb00e8045 Fixed shadowing bug 2017-07-27 23:51:07 +02:00
Mathias Hall-Andersen 92135131a7 Merge branch 'master' of git.zx2c4.com:wireguard-go 2017-07-27 23:46:01 +02:00
Mathias Hall-Andersen fb3fa4f915 Improved timer code 2017-07-27 23:45:37 +02:00
Mathias Hall-Andersen c3d9ae402d Close UDP connection when listen port changes 2017-07-23 16:21:08 +02:00
Mathias Hall-Andersen 2ed9dac3a5 Merge branch 'darwin' 2017-07-23 15:48:23 +02:00
Mathias Hall-Andersen 2a6dd2ed92 Fixed UAPI deadlock 2017-07-21 15:17:43 +02:00
Mathias Hall-Andersen 47f8a3d89a Moved remaining platform dependent UAPI code 2017-07-20 15:06:24 +02:00
Mathias Hall-Andersen 086d32186a Reviewed and added OSX patch
The patch was provided by:
Naveen Nathan <[email protected]>

The following modifications to the patch was made:

- Added copyright notice
- Fixed file descriptor leak in .MTU() method
- Migrated to the new(er) golang.org/x/sys/unix package
- Removed non-functioning Daemonize method
2017-07-19 13:12:25 +02:00
Mathias Hall-Andersen 18714fc4a4 Added last_handshake_time fields to UAPI 2017-07-18 15:22:56 +02:00
Mathias Hall-Andersen bd6027a4d5 Fixed file descriptor leak on linux 2017-07-18 14:15:29 +02:00
Mathias Hall-Andersen c5d7efc246 Fixed deadlock in index.go 2017-07-17 16:16:18 +02:00
Mathias Hall-Andersen dd4da93749 Added padding
Added plaintext padding and fixed default interface MTU
2017-07-15 16:27:59 +02:00
Mathias Hall-Andersen b21c82e32d Conforming to the cross-platform UX
The implementation now terminates when the unix socket is deleted.
Currently we are unable to use fsnotify (on linux),
since it does not notify on the deletion of open files.

The implementation can now daemonize (on linux)
or be kept in the foreground by providing the necessary flag.
2017-07-15 13:41:02 +02:00
Mathias Hall-Andersen 8993b3927c Improved throughput
- Improved performance by adding the message buffers to a sync.Pool.
- Fixed issue with computing "next" key-pair upon
  receiving a response message.
2017-07-14 14:25:18 +02:00
Mathias Hall-Andersen 0043008ad0 Endpoint discovery from handshake initiation 2017-07-13 21:29:22 +02:00
Mathias Hall-Andersen 93e3848ea7 Terminate on interface deletion
Program now terminates when the interface is removed
Increases the number of os threads (relevant for Go <1.5, not tested)
More consistent commenting
Improved logging (additional peer information)
2017-07-13 14:32:40 +02:00
Mathias Hall-Andersen 8393cbff52 Restructured MAC/cookie calculation
Added copy-right headers accidentally removed
2017-07-12 23:11:49 +02:00
Mathias Hall-Andersen 86707cbc88 Fixed MTU method for linux TUN interface
Updated the TUN interface
Added the "MTU" method for the linux implementation of the TUN interface
2017-07-11 22:48:58 +02:00
Mathias Hall-Andersen c273078376 Added ratelimiting of handshake messages 2017-07-11 18:48:29 +02:00
Mathias Hall-Andersen 9c4acb9f35 Fixed incomming initiation bug 2017-07-10 17:20:43 +02:00
Mathias Hall-Andersen 44c9896883 Added replay protection 2017-07-10 12:09:19 +02:00