]> git.ipfire.org Git - thirdparty/wireguard-tools.git/log
thirdparty/wireguard-tools.git
7 years agocontrib: keygen-html: rewrite in pure javascript
Jason A. Donenfeld [Fri, 23 Feb 2018 04:29:54 +0000 (05:29 +0100)] 
contrib: keygen-html: rewrite in pure javascript

Emscripten is too cumbersome. This code here is much slower, but it's
shorter and simpler.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: embedded-wg-library: add key generation functions
Jason A. Donenfeld [Wed, 21 Feb 2018 18:19:50 +0000 (19:19 +0100)] 
contrib: embedded-wg-library: add key generation functions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: embedded-wg-library: add ability to add and del interfaces
Jason A. Donenfeld [Wed, 21 Feb 2018 01:53:06 +0000 (02:53 +0100)] 
contrib: embedded-wg-library: add ability to add and del interfaces

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fixup errno handling
Jason A. Donenfeld [Sat, 17 Feb 2018 18:39:26 +0000 (19:39 +0100)] 
wg: fixup errno handling

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: FreeBSD doesn't have EAI_NODATA
Jason A. Donenfeld [Sat, 17 Feb 2018 18:30:05 +0000 (19:30 +0100)] 
wg: FreeBSD doesn't have EAI_NODATA

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: do not collide types with libc clashes
Jason A. Donenfeld [Sat, 17 Feb 2018 17:58:31 +0000 (18:58 +0100)] 
wg: do not collide types with libc clashes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: add embeddable wireguard library
Jason A. Donenfeld [Thu, 15 Feb 2018 12:50:12 +0000 (13:50 +0100)] 
contrib: add embeddable wireguard library

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg(8): clarify phrasing
Jason A. Donenfeld [Sat, 17 Feb 2018 04:54:48 +0000 (05:54 +0100)] 
wg(8): clarify phrasing

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: allow in-line comments
Jason A. Donenfeld [Fri, 16 Feb 2018 19:10:25 +0000 (20:10 +0100)] 
wg: allow in-line comments

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoexternal-tests: update go version
Jason A. Donenfeld [Thu, 15 Feb 2018 12:12:28 +0000 (13:12 +0100)] 
external-tests: update go version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: normalize strncpy/snprintf usage
Jason A. Donenfeld [Wed, 14 Feb 2018 22:21:11 +0000 (23:21 +0100)] 
wg: normalize strncpy/snprintf usage

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: match from beginning rather than shift right
Jason A. Donenfeld [Tue, 6 Feb 2018 11:52:09 +0000 (12:52 +0100)] 
wg-quick: match from beginning rather than shift right

Before, this meant that it simply took the last 15 characters, instead
of erroring out when there's more than 15 chars.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: endian.h is not portable
Jason A. Donenfeld [Mon, 5 Feb 2018 11:23:10 +0000 (12:23 +0100)] 
wg: endian.h is not portable

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agokeygen-html: fix up copyright
Jason A. Donenfeld [Fri, 2 Feb 2018 21:03:11 +0000 (22:03 +0100)] 
keygen-html: fix up copyright

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocurve25519: replace fiat64 with faster hacl64
Jason A. Donenfeld [Thu, 1 Feb 2018 18:15:28 +0000 (19:15 +0100)] 
curve25519: replace fiat64 with faster hacl64

This reverts commit da4ff396cc5d5e0ff21f9ecbc2f951c048c63fff and adds
some optimizations to hacl64.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocurve25519: replace hacl64 with fiat64
Jason A. Donenfeld [Wed, 31 Jan 2018 15:53:59 +0000 (16:53 +0100)] 
curve25519: replace hacl64 with fiat64

For now, it's faster:

hacl64: 109782 cycles per call
fiat64: 108984 cycles per call

It's quite possible this commit will be reverted with nice changes from
INRIA, though.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: dedup secret normalization
Jason A. Donenfeld [Wed, 31 Jan 2018 14:58:17 +0000 (15:58 +0100)] 
wg: dedup secret normalization

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fread doesn't change errno
Jason A. Donenfeld [Mon, 29 Jan 2018 20:40:08 +0000 (21:40 +0100)] 
wg: fread doesn't change errno

Thus we might be responding to an old errno, which could cause this to
unnecessarily fail.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: keygen-html: share curve25519 implementation with kernel
Jason A. Donenfeld [Mon, 22 Jan 2018 17:11:32 +0000 (18:11 +0100)] 
contrib: keygen-html: share curve25519 implementation with kernel

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: share curve25519 implementations with kernel
Jason A. Donenfeld [Mon, 22 Jan 2018 16:58:44 +0000 (17:58 +0100)] 
wg: share curve25519 implementations with kernel

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocurve25519-fiat32: uninline certain functions
Jason A. Donenfeld [Thu, 18 Jan 2018 17:41:45 +0000 (18:41 +0100)] 
curve25519-fiat32: uninline certain functions

While this has a negative performance impact on x86_64, it has a
positive performance impact on smaller machines, which is where we're
actually using this code. For example, an A53:

Before: fiat32: 228605 cycles per call
After: fiat32: 188307 cycles per call
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: keygen-html: update curve25519 implementation
Jason A. Donenfeld [Thu, 18 Jan 2018 10:50:49 +0000 (11:50 +0100)] 
contrib: keygen-html: update curve25519 implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: import new curve25519 implementations
Jason A. Donenfeld [Thu, 18 Jan 2018 10:46:01 +0000 (11:46 +0100)] 
wg: import new curve25519 implementations

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: plug memleak in config error path
Jason A. Donenfeld [Thu, 18 Jan 2018 10:24:04 +0000 (11:24 +0100)] 
wg: plug memleak in config error path

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoexternal-tests: add python implementation
Piotr Lizończyk [Wed, 10 Jan 2018 16:46:57 +0000 (17:46 +0100)] 
external-tests: add python implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: ifnames have max len of 15
Jason A. Donenfeld [Wed, 10 Jan 2018 01:37:03 +0000 (02:37 +0100)] 
wg-quick: ifnames have max len of 15

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: year bump
Jason A. Donenfeld [Wed, 3 Jan 2018 20:58:00 +0000 (21:58 +0100)] 
global: year bump

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: dumber matching for default routes
Jason A. Donenfeld [Wed, 13 Dec 2017 00:17:55 +0000 (01:17 +0100)] 
wg-quick: dumber matching for default routes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: add the "Table" config option
Luis Ressel [Tue, 12 Dec 2017 22:10:08 +0000 (23:10 +0100)] 
wg-quick: add the "Table" config option

* Table=auto (default) selects the current behaviour
* Table=off disables creation of routes altogether
* All other values are passed through to "ip route add"'s table option

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agokeygen-html: remove prebuilt file
Jason A. Donenfeld [Tue, 12 Dec 2017 00:08:18 +0000 (01:08 +0100)] 
keygen-html: remove prebuilt file

We also reduce the optimization level, just in case, but add closure
compiler into the mix.

Suggested-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: add SPDX tags to all files
Greg Kroah-Hartman [Thu, 30 Nov 2017 15:23:50 +0000 (15:23 +0000)] 
global: add SPDX tags to all files

It's good to have SPDX identifiers in all files as the Linux kernel
developers are working to add these identifiers to all files.

Update all files with the correct SPDX license identifier based on the license
text of the project or based on the license in the file itself.  The SPDX
identifier is a legally binding shorthand, which can be used instead of the
full boiler plate text.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Modified-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: no need to put this on the stack
Jason A. Donenfeld [Fri, 1 Dec 2017 18:42:46 +0000 (19:42 +0100)] 
wg: no need to put this on the stack

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: remove undocumented unused syntax
Jason A. Donenfeld [Fri, 1 Dec 2017 18:41:16 +0000 (19:41 +0100)] 
wg: remove undocumented unused syntax

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: keygen-html for generating keys in the browser
Jason A. Donenfeld [Fri, 1 Dec 2017 12:31:33 +0000 (13:31 +0100)] 
contrib: keygen-html for generating keys in the browser

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fix removing preshared keys
Jason A. Donenfeld [Thu, 23 Nov 2017 00:17:25 +0000 (01:17 +0100)] 
wg: fix removing preshared keys

Also clean up related logic quite a bit and add unit tests.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: switch from timeval to timespec
Jason A. Donenfeld [Wed, 22 Nov 2017 15:49:56 +0000 (16:49 +0100)] 
global: switch from timeval to timespec

This gets us nanoseconds instead of microseconds, which is better, and
we can do this pretty much without freaking out existing userspace,
which doesn't actually make use of the nano/micro seconds field:

zx2c4@thinkpad ~ $ cat a.c
void main()
{
        puts(sizeof(struct timeval) == sizeof(struct timespec) ? "success" : "failure");
}
zx2c4@thinkpad ~ $ gcc a.c -m64 && ./a.out
success
zx2c4@thinkpad ~ $ gcc a.c -m32 && ./a.out
success

This doesn't solve y2038 problem, but timespec64 isn't yet a thing in
userspace.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: tighten up strtoul parsing
Jason A. Donenfeld [Fri, 17 Nov 2017 12:39:02 +0000 (13:39 +0100)] 
wg: tighten up strtoul parsing

Reported-by: Cedric Buxin <cedric.buxin@izri.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: document localhost exception and v6 rule
Jason A. Donenfeld [Sat, 11 Nov 2017 15:49:34 +0000 (00:49 +0900)] 
wg-quick: document localhost exception and v6 rule

Reported-by: Hermann Lienstromberg <nurtic-vibe@grmml.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: allow for NULL keys everywhere
Jason A. Donenfeld [Sat, 11 Nov 2017 03:30:21 +0000 (12:30 +0900)] 
wg: allow for NULL keys everywhere

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: remove ioctl cruft
Jason A. Donenfeld [Fri, 10 Nov 2017 08:30:24 +0000 (17:30 +0900)] 
wg: remove ioctl cruft

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow for tabs in keys
Jason A. Donenfeld [Thu, 9 Nov 2017 05:12:06 +0000 (14:12 +0900)] 
wg-quick: allow for tabs in keys

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: stat the correct enclosing folder of config file
Jason A. Donenfeld [Wed, 8 Nov 2017 09:40:07 +0000 (18:40 +0900)] 
wg-quick: stat the correct enclosing folder of config file

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: save all hooks on save
Jason A. Donenfeld [Tue, 31 Oct 2017 18:47:39 +0000 (19:47 +0100)] 
wg-quick: save all hooks on save

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: fsync the temporary file before renaming
Jason A. Donenfeld [Tue, 31 Oct 2017 17:13:31 +0000 (18:13 +0100)] 
wg-quick: fsync the temporary file before renaming

This ensures that on an unclean shutdown, we either see the old content
or the new content, but not empty content.

Suggested-by: Ka Ho Ng <ngkaho1234@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow for saving existing interface
Jason A. Donenfeld [Tue, 31 Oct 2017 16:51:38 +0000 (17:51 +0100)] 
wg-quick: allow for saving existing interface

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: add reresolve-dns
Jason A. Donenfeld [Tue, 31 Oct 2017 15:15:19 +0000 (16:15 +0100)] 
contrib: add reresolve-dns

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: correct type for CTRL_ATTR_FAMILY_ID
Jason A. Donenfeld [Tue, 31 Oct 2017 13:55:17 +0000 (14:55 +0100)] 
wg: correct type for CTRL_ATTR_FAMILY_ID

Suggested-by: Jörg Thalheim <joerg@thalheim.io>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow for the hatchet, but not by default
Jason A. Donenfeld [Tue, 31 Oct 2017 10:38:09 +0000 (11:38 +0100)] 
wg-quick: allow for the hatchet, but not by default

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: remember to rewind DNS settings on failure
Jason A. Donenfeld [Thu, 26 Oct 2017 20:49:46 +0000 (22:49 +0200)] 
wg-quick: remember to rewind DNS settings on failure

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow specifiying multiple hooks
Jason A. Donenfeld [Wed, 25 Oct 2017 19:55:17 +0000 (21:55 +0200)] 
wg-quick: allow specifiying multiple hooks

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: style nits
Jason A. Donenfeld [Wed, 25 Oct 2017 15:56:08 +0000 (17:56 +0200)] 
global: style nits

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: infuriating kernel iterator style
Jason A. Donenfeld [Wed, 25 Oct 2017 15:13:46 +0000 (17:13 +0200)] 
global: infuriating kernel iterator style

One types:

   for (i = 0 ...

So one should also type:

  for_each_obj (obj ...

But the upstream kernel style guidelines are insane, and so we must
instead do:

  for_each_obj(obj ...

Ugly, but one must choose his battles wisely.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: account for padding being in zero attribute
Jason A. Donenfeld [Tue, 17 Oct 2017 17:20:52 +0000 (19:20 +0200)] 
wg: account for padding being in zero attribute

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: newline after warning
Jason A. Donenfeld [Tue, 17 Oct 2017 16:48:41 +0000 (18:48 +0200)] 
wg: newline after warning

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: style
Jason A. Donenfeld [Mon, 16 Oct 2017 20:18:29 +0000 (22:18 +0200)] 
wg: style

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: add pass example to wg-quick man page
Jason A. Donenfeld [Mon, 16 Oct 2017 01:28:24 +0000 (03:28 +0200)] 
wg: add pass example to wg-quick man page

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: don't insist on having a private key
Jason A. Donenfeld [Mon, 16 Oct 2017 01:17:12 +0000 (03:17 +0200)] 
wg: don't insist on having a private key

This lets us do flexible things from wg-quick such as:

PostUp = wg set %i private-key <(pass WireGuard/private-keys/%i)

It also was never a very sensible policy to enforce.

Suggested-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: retry resolution except when fatal
Jason A. Donenfeld [Sun, 15 Oct 2017 20:52:38 +0000 (22:52 +0200)] 
wg: retry resolution except when fatal

The reference to this is <https://sourceware.org/glibc/wiki/NameResolver>,
which mentions:

"From the perspective of the application that calls getaddrinfo() it
perhaps doesn't matter that much since EAI_FAIL, EAI_NONAME and
EAI_NODATA are all permanent failure codes and the causes are all
permanent failures in the sense that there is no point in retrying
later."

This should cover more early-boot situations.

While we're at it, we clean up the logic a bit so that we don't have a
retry message on the final non-retrying attempt. We also peer into errno
when receiving EAI_SYSTEM, to report to the user what actually happened.

Also, fix the quoting back tick front tick mess.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: encoding: be more paranoid
Jason A. Donenfeld [Sun, 15 Oct 2017 19:29:01 +0000 (21:29 +0200)] 
wg: encoding: be more paranoid

Needless, but overkill can be fun.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoMakefile: even prettier output
Jason A. Donenfeld [Sat, 14 Oct 2017 03:17:40 +0000 (05:17 +0200)] 
Makefile: even prettier output

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: man: include kill-switch documentation using fwmark
Jason A. Donenfeld [Tue, 10 Oct 2017 23:55:45 +0000 (01:55 +0200)] 
wg: man: include kill-switch documentation using fwmark

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: store tail pointer to make coalescing peers fast
Jason A. Donenfeld [Tue, 10 Oct 2017 15:17:43 +0000 (17:17 +0200)] 
wg: store tail pointer to make coalescing peers fast

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: warn once on unrecognized items
Jason A. Donenfeld [Mon, 9 Oct 2017 11:27:00 +0000 (13:27 +0200)] 
wg: warn once on unrecognized items

DaveM suggests we do in fact do this. Others on the same thread weren't
happy about the length of the proposed message, so we also give a bit of
a less dramatic warning.

This reverts commit a2cc976a3b572cf308cc2d97c080eacac60416fe.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: try again if dump is interrupted
Jason A. Donenfeld [Sun, 8 Oct 2017 14:24:37 +0000 (16:24 +0200)] 
wg: try again if dump is interrupted

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoMakefile: clang now builds the kernel, so use scan-build
Jason A. Donenfeld [Thu, 5 Oct 2017 18:52:19 +0000 (20:52 +0200)] 
Makefile: clang now builds the kernel, so use scan-build

Also add little stub for coccinelle and clean up semicolon issue it
found.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoMakefile: add non-verbose mode to tools
Jason A. Donenfeld [Tue, 3 Oct 2017 15:16:37 +0000 (17:16 +0200)] 
Makefile: add non-verbose mode to tools

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: satisfy bitshift pedantry
Jason A. Donenfeld [Tue, 3 Oct 2017 04:18:45 +0000 (06:18 +0200)] 
global: satisfy bitshift pedantry

Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: remove worthless build artifact
Jason A. Donenfeld [Mon, 2 Oct 2017 14:32:20 +0000 (16:32 +0200)] 
contrib: remove worthless build artifact

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: compile on non-Linux
Jason A. Donenfeld [Mon, 2 Oct 2017 11:05:35 +0000 (13:05 +0200)] 
wg: compile on non-Linux

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: simmer down silly compilers
Jason A. Donenfeld [Mon, 2 Oct 2017 01:44:06 +0000 (03:44 +0200)] 
wg: simmer down silly compilers

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: do not warn on unrecognized items
Jason A. Donenfeld [Mon, 2 Oct 2017 00:51:57 +0000 (02:51 +0200)] 
wg: do not warn on unrecognized items

Upstream advice is to simply be silent.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: check permissions of parent directory
Jason A. Donenfeld [Sun, 1 Oct 2017 20:05:19 +0000 (22:05 +0200)] 
wg-quick: check permissions of parent directory

Also prefix octal 0, in case these files are actually of modes that
don't start with 0 by accident (such as SUID or sticky bit).

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: verify wireguard interface in more clever way
Jason A. Donenfeld [Sun, 1 Oct 2017 19:42:32 +0000 (21:42 +0200)] 
wg-quick: verify wireguard interface in more clever way

This helps with old Debian which has ancient iproute2, as well as paving
the path toward this script supporting userspace implementations.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: anchor sysctl regex to start and end
Jason A. Donenfeld [Sun, 1 Oct 2017 19:37:53 +0000 (21:37 +0200)] 
wg-quick: anchor sysctl regex to start and end

This doesn't actually fix a real problem, but it is more correct than
not having it.

Suggested-by: Aaron Sigel <aaron@vtty.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agonetlink: switch from ioctl to netlink for configuration
Jason A. Donenfeld [Mon, 25 Sep 2017 02:22:09 +0000 (04:22 +0200)] 
netlink: switch from ioctl to netlink for configuration

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: uapi: only make sure socket file is socket
Jason A. Donenfeld [Tue, 26 Sep 2017 13:02:41 +0000 (15:02 +0200)] 
wg: uapi: only make sure socket file is socket

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: use key_is_zero for comparing to zeros
Jason A. Donenfeld [Fri, 22 Sep 2017 02:04:00 +0000 (04:04 +0200)] 
wg: use key_is_zero for comparing to zeros

Maybe an attacker on the system could use the infoleak in /proc to gauge
how long a wg(8) process takes to complete and determine the number of
leading zeros. This is somewhat ridiculous, but it's possible somebody
somewhere might at somepoint care in the future, so alright.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: add sticky sockets example code
Jason A. Donenfeld [Tue, 19 Sep 2017 21:17:56 +0000 (23:17 +0200)] 
contrib: add sticky sockets example code

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: only bash complete existing interfaces for down
Jason A. Donenfeld [Wed, 6 Sep 2017 18:51:41 +0000 (20:51 +0200)] 
wg-quick: only bash complete existing interfaces for down

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fix removal of psk
Jason A. Donenfeld [Wed, 23 Aug 2017 18:51:52 +0000 (12:51 -0600)] 
wg: fix removal of psk

This is an attribute of the peer, not the device.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: stricter userspace ipc parsing
Jason A. Donenfeld [Wed, 2 Aug 2017 19:07:25 +0000 (21:07 +0200)] 
wg: stricter userspace ipc parsing

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agocontrib: move Android tools to wireguard-android repo
Jason A. Donenfeld [Mon, 31 Jul 2017 01:03:06 +0000 (03:03 +0200)] 
contrib: move Android tools to wireguard-android repo

https: //git.zx2c4.com/wireguard-android/
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoandroid: fix readme
Jason A. Donenfeld [Wed, 26 Jul 2017 02:10:33 +0000 (04:10 +0200)] 
android: fix readme

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: add explicit support for common DNS usage
Jason A. Donenfeld [Wed, 26 Jul 2017 01:09:48 +0000 (03:09 +0200)] 
wg-quick: add explicit support for common DNS usage

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: do not use grep
Jason A. Donenfeld [Mon, 24 Jul 2017 21:22:10 +0000 (23:22 +0200)] 
wg-quick: do not use grep

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: do not set explicit src route for v6 default route
Jason A. Donenfeld [Mon, 24 Jul 2017 14:08:42 +0000 (16:08 +0200)] 
wg-quick: do not set explicit src route for v6 default route

This was only required because clueless network operators were trying to
route fec0::/10 globally, when that range doesn't actually have global
scope. Now that we understand the cause was operator error, we revert
the change here, so that the routing table is kept consistent.

This reverts commit 64e47de870a2f0575b5564a70e5680b48ab83ff9.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoandroid: add port of wg-quick
Jason A. Donenfeld [Thu, 20 Jul 2017 04:07:48 +0000 (06:07 +0200)] 
android: add port of wg-quick

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: usage typos
Jason A. Donenfeld [Thu, 20 Jul 2017 04:29:14 +0000 (06:29 +0200)] 
wg-quick: usage typos

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoglobal: wireguard.io --> wireguard.com
Jason A. Donenfeld [Sun, 16 Jul 2017 14:12:20 +0000 (16:12 +0200)] 
global: wireguard.io --> wireguard.com

Due to concerns with the .io TLD, we are switching to using
wireguard.com instead.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agogitignore: ignore split DWARF debug info
Samuel Holland [Wed, 31 May 2017 16:30:59 +0000 (11:30 -0500)] 
gitignore: ignore split DWARF debug info

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: remove double include in ipc
Jason A. Donenfeld [Thu, 29 Jun 2017 12:34:27 +0000 (14:34 +0200)] 
wg: remove double include in ipc

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: use printf -v instead of namerefs for bash 4.2
Jason A. Donenfeld [Tue, 27 Jun 2017 20:18:13 +0000 (22:18 +0200)] 
wg-quick: use printf -v instead of namerefs for bash 4.2

I'm not happy about this.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: properly match IPv6 endpoint
Jason A. Donenfeld [Fri, 23 Jun 2017 12:48:03 +0000 (14:48 +0200)] 
wg-quick: properly match IPv6 endpoint

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agohaskell: re-add updated haskell example
Jason A. Donenfeld [Tue, 13 Jun 2017 21:35:27 +0000 (23:35 +0200)] 
haskell: re-add updated haskell example

Code-from: John Galt <jgalt@centromere.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: use proper __linux__ ifdef
Jason A. Donenfeld [Mon, 12 Jun 2017 15:01:23 +0000 (17:01 +0200)] 
wg: use proper __linux__ ifdef

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: match ipv6 default route more broadly
Jason A. Donenfeld [Sun, 11 Jun 2017 22:20:31 +0000 (00:20 +0200)] 
wg-quick: match ipv6 default route more broadly

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: make sure we have empty table for both v6 and v4
Jason A. Donenfeld [Sun, 11 Jun 2017 21:39:17 +0000 (23:39 +0200)] 
wg-quick: make sure we have empty table for both v6 and v4

Otherwise, we wind up not doing the right thing in the v6-only case, or
doing something totally borked when v4 and v6 are filled unevenly.

Reported-by: Roelf Wichertjes <contact@roelf.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoexternal-tests: trim the fat
Jason A. Donenfeld [Fri, 9 Jun 2017 00:56:08 +0000 (02:56 +0200)] 
external-tests: trim the fat

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agogo test: use x/crypto for blake2s now that we have 128-bit mac
Jason A. Donenfeld [Tue, 6 Jun 2017 14:50:20 +0000 (16:50 +0200)] 
go test: use x/crypto for blake2s now that we have 128-bit mac

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agogo test: correct tai64n and formatting
Jason A. Donenfeld [Thu, 1 Jun 2017 17:08:24 +0000 (19:08 +0200)] 
go test: correct tai64n and formatting

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>