]> git.ipfire.org Git - thirdparty/wireguard-tools.git/log
thirdparty/wireguard-tools.git
6 years agoglobal: prefer sizeof(*pointer) when possible
Jason A. Donenfeld [Tue, 4 Sep 2018 16:44:42 +0000 (10:44 -0600)] 
global: prefer sizeof(*pointer) when possible

Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocrypto: import zinc
Jason A. Donenfeld [Wed, 29 Aug 2018 05:50:35 +0000 (23:50 -0600)] 
crypto: import zinc

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: ipc: do not warn on unrecognized netlink attributes
Jason A. Donenfeld [Mon, 3 Sep 2018 01:25:32 +0000 (19:25 -0600)] 
wg: ipc: do not warn on unrecognized netlink attributes

It makes extending things more difficult.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocrypto: use unaligned helpers
Jason A. Donenfeld [Fri, 24 Aug 2018 01:08:03 +0000 (18:08 -0700)] 
crypto: use unaligned helpers

This is not useful for WireGuard, but for the general use case we
probably want it this way, and the speed difference is mostly lost in
the noise.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: check correct variable for route deduplication
Jason A. Donenfeld [Tue, 21 Aug 2018 22:42:17 +0000 (15:42 -0700)] 
wg-quick: check correct variable for route deduplication

Reported-by: John Sager <john@sager.me.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: darwin: prefer system paths for tools
Jason A. Donenfeld [Sun, 12 Aug 2018 07:28:28 +0000 (00:28 -0700)] 
wg-quick: darwin: prefer system paths for tools

The only things wg-quick(8) needs from Homebrew are bash(1) and wg(8).
Other than that, it's explicitly coded against the native system
utilities. Since wg-quick(8) and bash(1) are invoked in auto_su by their
full absolute path (via $SELF and $BASH, respectively), we can simply
set the $PATH to be prefixed by the default system binary paths. This
way, if users install tools that conflict with system tools -- such as
GNU coreutils -- we won't accidently call those.

Reported-by: Deirdre Connolly <durumcrustulum@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: remove compat code
Jason A. Donenfeld [Tue, 24 Jul 2018 16:05:33 +0000 (18:05 +0200)] 
wg-quick: android: remove compat code

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: allow package to be overridden
Jason A. Donenfeld [Tue, 24 Jul 2018 11:12:40 +0000 (13:12 +0200)] 
wg-quick: android: allow package to be overridden

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoembeddable-wg-library: do not left shift negative numbers
Jason A. Donenfeld [Thu, 19 Jul 2018 17:15:15 +0000 (19:15 +0200)] 
embeddable-wg-library: do not left shift negative numbers

Otherwise we incur undefined behavior.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow link local default gateway
Jason A. Donenfeld [Mon, 16 Jul 2018 15:27:00 +0000 (17:27 +0200)] 
wg-quick: allow link local default gateway

It's unclear why it was like this in the first place, but it apparently
broke certain IPv6 setups.

Reported-by: Jonas Blahut <j@die-blahuts.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: only error on wg show if all interfaces fail
Jason A. Donenfeld [Sun, 8 Jul 2018 17:46:05 +0000 (19:46 +0200)] 
wg: only error on wg show if all interfaces fail

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: support excluding applications
Jason A. Donenfeld [Thu, 5 Jul 2018 17:26:13 +0000 (19:26 +0200)] 
wg-quick: android: support excluding applications

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: prevent outgoing handshake packets from being dropped
Jason A. Donenfeld [Mon, 25 Jun 2018 03:43:16 +0000 (05:43 +0200)] 
wg-quick: android: prevent outgoing handshake packets from being dropped

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fix misspelling of strchrnul in comment
Jonathan Neuschäfer [Thu, 21 Jun 2018 23:39:25 +0000 (01:39 +0200)] 
wg: fix misspelling of strchrnul in comment

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agomanpages: eliminate whitespace at the end of the line
Jonathan Neuschäfer [Thu, 21 Jun 2018 23:39:25 +0000 (01:39 +0200)] 
manpages: eliminate whitespace at the end of the line

This eliminates a few style warnings from "mandoc -T lint src/tools/wg*.8".

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: don't forget to free compiled regexes
Jason A. Donenfeld [Sun, 17 Jun 2018 03:13:22 +0000 (05:13 +0200)] 
wg-quick: android: don't forget to free compiled regexes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: disable roaming to v6 networks when v4 is specified
Jason A. Donenfeld [Sun, 17 Jun 2018 03:06:37 +0000 (05:06 +0200)] 
wg-quick: android: disable roaming to v6 networks when v4 is specified

This works around an unfortunate bug in 464XLAT transitions.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agodns-hatchet: apply resolv.conf's selinux context to new resolv.conf
Jason A. Donenfeld [Sat, 16 Jun 2018 22:06:58 +0000 (00:06 +0200)] 
dns-hatchet: apply resolv.conf's selinux context to new resolv.conf

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: getentropy requires 10.12
Jason A. Donenfeld [Thu, 14 Jun 2018 02:18:15 +0000 (04:18 +0200)] 
wg: getentropy requires 10.12

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: support getentropy(3)
Jason A. Donenfeld [Fri, 8 Jun 2018 01:18:28 +0000 (03:18 +0200)] 
wg: support getentropy(3)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: encoding: add missing static array constraints
Jason A. Donenfeld [Tue, 5 Jun 2018 22:05:47 +0000 (00:05 +0200)] 
wg: encoding: add missing static array constraints

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: change name of intent
Jason A. Donenfeld [Mon, 4 Jun 2018 00:49:20 +0000 (02:49 +0200)] 
wg-quick: android: change name of intent

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: android: delay setting users until end
Jason A. Donenfeld [Thu, 31 May 2018 14:38:06 +0000 (16:38 +0200)] 
wg-quick: android: delay setting users until end

`ndc users add` eventually invokes SOCK_DESTROY on user sockets, causing
them to reconnect. By delaying this until after routes are set, we
ensure that the sockets reconnect using the tunnel, rather than the old
route.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: constanter time encoding
Jason A. Donenfeld [Wed, 30 May 2018 19:32:27 +0000 (21:32 +0200)] 
wg: constanter time encoding

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: set DNS servers after delay on route change
Jason A. Donenfeld [Tue, 29 May 2018 23:37:57 +0000 (01:37 +0200)] 
wg-quick: darwin: set DNS servers after delay on route change

This works around a race condition in macOS's network daemons, while
also adding one in the form of possibly calling kill -ALRM on a stale
PID; unfortunately bash can't wait from a trap.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: freebsd: configure as p2p link
Jason A. Donenfeld [Sun, 27 May 2018 03:24:07 +0000 (05:24 +0200)] 
wg-quick: freebsd: configure as p2p link

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: add multiple IP addresses
Jason A. Donenfeld [Sun, 27 May 2018 03:22:55 +0000 (05:22 +0200)] 
wg-quick: darwin: add multiple IP addresses

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: determine IPs when saving interface
Jason A. Donenfeld [Sun, 27 May 2018 00:42:04 +0000 (02:42 +0200)] 
wg-quick: determine IPs when saving interface

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: freebsd: work around security vulnerabilities in bash
Jason A. Donenfeld [Wed, 23 May 2018 14:33:14 +0000 (16:33 +0200)] 
wg-quick: freebsd: work around security vulnerabilities in bash

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: allow enumeration of socket files
Jason A. Donenfeld [Wed, 23 May 2018 13:31:47 +0000 (15:31 +0200)] 
wg-quick: allow enumeration of socket files

These OSes have an unpriv'd ifconfig, so this isn't an even larger info
leak.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: better bash completion for non-renaming OSes
Jason A. Donenfeld [Wed, 23 May 2018 13:17:41 +0000 (15:17 +0200)] 
wg-quick: better bash completion for non-renaming OSes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: support FreeBSD/Darwin search path
Jason A. Donenfeld [Wed, 23 May 2018 13:08:30 +0000 (15:08 +0200)] 
wg-quick: support FreeBSD/Darwin search path

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: always pass -v as first argument to install
Jason A. Donenfeld [Wed, 23 May 2018 03:20:34 +0000 (05:20 +0200)] 
wg: always pass -v as first argument to install

This lets crippled OSes sed out our -v more easily.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: openbsd: add new implementation
Jason A. Donenfeld [Tue, 22 May 2018 14:32:01 +0000 (16:32 +0200)] 
wg-quick: openbsd: add new implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: freebsd: add new implementation
Jason A. Donenfeld [Mon, 21 May 2018 20:04:37 +0000 (22:04 +0200)] 
wg-quick: freebsd: add new implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: do not remove routes when no real interface
Jason A. Donenfeld [Tue, 22 May 2018 14:32:40 +0000 (16:32 +0200)] 
wg-quick: darwin: do not remove routes when no real interface

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: rename namefile environment variable
Jason A. Donenfeld [Tue, 22 May 2018 13:28:06 +0000 (15:28 +0200)] 
wg-quick: darwin: rename namefile environment variable

This paves the way for an openbsd implementation.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fix OpenBSD build
Filippo Valsorda [Mon, 21 May 2018 04:10:54 +0000 (00:10 -0400)] 
wg: fix OpenBSD build

License: MIT
Signed-off-by: Filippo Valsorda <valsorda@google.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoncat-client-server: do not always call sudo and use env bash
Jason A. Donenfeld [Mon, 21 May 2018 23:08:51 +0000 (01:08 +0200)] 
ncat-client-server: do not always call sudo and use env bash

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: fix errno propagation and messages
Jason A. Donenfeld [Fri, 18 May 2018 17:51:33 +0000 (19:51 +0200)] 
wg: fix errno propagation and messages

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: simpler inclusion check
Jason A. Donenfeld [Thu, 17 May 2018 17:29:48 +0000 (19:29 +0200)] 
wg-quick: darwin: simpler inclusion check

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: reorder functions
Jason A. Donenfeld [Thu, 17 May 2018 02:58:27 +0000 (04:58 +0200)] 
wg-quick: darwin: reorder functions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: networksetup does not like missing stdio
Jason A. Donenfeld [Thu, 17 May 2018 02:50:18 +0000 (04:50 +0200)] 
wg-quick: darwin: networksetup does not like missing stdio

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: avoid routing loop if no default
Jason A. Donenfeld [Thu, 17 May 2018 02:07:11 +0000 (04:07 +0200)] 
wg-quick: darwin: avoid routing loop if no default

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: sometimes there are no network services
Jason A. Donenfeld [Thu, 17 May 2018 01:26:51 +0000 (03:26 +0200)] 
wg-quick: darwin: sometimes there are no network services

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: use invoking shell in auto rooting
Jason A. Donenfeld [Wed, 16 May 2018 17:19:48 +0000 (19:19 +0200)] 
wg-quick: use invoking shell in auto rooting

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: add intentionally undocumented userspace implementation knob
Jason A. Donenfeld [Wed, 16 May 2018 02:12:02 +0000 (04:12 +0200)] 
wg-quick: add intentionally undocumented userspace implementation knob

This knob might disappear at some point, and we don't want to encourage
its use, so it's not being documented, but this should help with
development of new implementations.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: use bash from environment and require bash 4+
Jason A. Donenfeld [Wed, 16 May 2018 02:15:05 +0000 (04:15 +0200)] 
wg-quick: darwin: use bash from environment and require bash 4+

For properly configured Homebrew installations /usr/local/bin should be
before /bin, so this should still work. This allows the script to be
used in more than one setting.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: restore DNS on down
Jason A. Donenfeld [Wed, 16 May 2018 01:09:33 +0000 (03:09 +0200)] 
wg-quick: darwin: restore DNS on down

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: bash correctness
Jason A. Donenfeld [Wed, 16 May 2018 00:17:33 +0000 (02:17 +0200)] 
wg-quick: darwin: bash correctness

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: remove v6 routes after shutdown
Jason A. Donenfeld [Tue, 15 May 2018 21:12:15 +0000 (23:12 +0200)] 
wg-quick: darwin: remove v6 routes after shutdown

This works around a Darwin kernel bug regarding interface removal.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: darwin: ensure socket directory exists
Jason A. Donenfeld [Tue, 15 May 2018 18:05:48 +0000 (20:05 +0200)] 
wg-quick: darwin: ensure socket directory exists

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agodns-hatchet: update paths
Jason A. Donenfeld [Tue, 15 May 2018 19:48:41 +0000 (21:48 +0200)] 
dns-hatchet: update paths

Suggested-by: Martin Hauke <mardnh@gmx.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoncat-client-server: add wg-quick variant
Jason A. Donenfeld [Tue, 15 May 2018 00:26:55 +0000 (02:26 +0200)] 
ncat-client-server: add wg-quick variant

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: add darwin implementation
Jason A. Donenfeld [Mon, 14 May 2018 20:28:53 +0000 (22:28 +0200)] 
wg-quick: add darwin implementation

It's pretty rough and leaves much to be desired, but it works.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: add wg symlink
Jason A. Donenfeld [Mon, 14 May 2018 17:23:17 +0000 (19:23 +0200)] 
wg-quick: add wg symlink

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: add android implementation
Jason A. Donenfeld [Mon, 14 May 2018 16:20:13 +0000 (18:20 +0200)] 
wg-quick: add android implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg: reorganize for multiplatform wg-quick
Jason A. Donenfeld [Mon, 14 May 2018 16:14:55 +0000 (18:14 +0200)] 
wg: reorganize for multiplatform wg-quick

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: preliminary support for go implementation
Jason A. Donenfeld [Sat, 5 May 2018 01:54:55 +0000 (03:54 +0200)] 
wg-quick: preliminary support for go implementation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoembeddable-wg-library: zero attribute padding
Jason A. Donenfeld [Thu, 3 May 2018 17:07:55 +0000 (19:07 +0200)] 
embeddable-wg-library: zero attribute padding

See: http://git.netfilter.org/libmnl/commit/?id=37c876b55a2c00424ccda5a300ab5fdec1d88b22
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agokeygen-html: add zip file example
Jason A. Donenfeld [Tue, 1 May 2018 23:27:41 +0000 (01:27 +0200)] 
keygen-html: add zip file example

A little bit more JavaScript for easy copy&pasting.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: account for specified fwmark in auto routing mode
Jason A. Donenfeld [Sat, 14 Apr 2018 00:34:28 +0000 (02:34 +0200)] 
wg-quick: account for specified fwmark in auto routing mode

If we're doing automatic routing with default routes, but the config has
also specified an explicit fwmark, then use that explicit fwmark, even
if it's conflicting, since the administrator has explicitly opted into
using it. Also, when shutting down the interface, we only now remove the
fancy rules if we're in automatic routing mode with default routes.

Suggested-by: Luis Ressel <aranea@aixah.de>
Reported-by: Saeid Akbari <saeidscorp@yahoo.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick.8: fix typo
Jason A. Donenfeld [Wed, 4 Apr 2018 14:53:20 +0000 (10:53 -0400)] 
wg-quick.8: fix typo

Reported-by: Mike Pechkin <mike.pechkin@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: hide errors on save
Jason A. Donenfeld [Sun, 4 Mar 2018 18:03:54 +0000 (19:03 +0100)] 
wg-quick: hide errors on save

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agocontrib: add extract-handshakes kprobe example
Jason A. Donenfeld [Tue, 27 Feb 2018 23:17:43 +0000 (00:17 +0100)] 
contrib: add extract-handshakes kprobe example

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: if resolvconf/run/iface exists, use it
Jason A. Donenfeld [Wed, 28 Feb 2018 18:46:28 +0000 (19:46 +0100)] 
wg-quick: if resolvconf/run/iface exists, use it

Some older broken resolvconfs don't support resolvconf -l, but do have a
file in a standard location, so use it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agowg-quick: if resolvconf/interface-order exists, use it
Jason A. Donenfeld [Wed, 28 Feb 2018 18:24:31 +0000 (19:24 +0100)] 
wg-quick: if resolvconf/interface-order exists, use it

Some older broken resolvconf implementations ignore -m, but do have an
interface-order list. It's better to use this list dynamically, in case
it changes, or in case it's not used by the OS's resolvconf
implementation, such as in the case of systemd or openresolv.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoglobal: in gnu code, use un-underscored asm
Jason A. Donenfeld [Mon, 26 Feb 2018 23:49:16 +0000 (00:49 +0100)] 
global: in gnu code, use un-underscored asm

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
7 years agoRevert "contrib: keygen-html: rewrite in pure javascript"
Jason A. Donenfeld [Thu, 1 Mar 2018 01:14:50 +0000 (02:14 +0100)] 
Revert "contrib: keygen-html: rewrite in pure javascript"

This reverts commit e5203543a674453ce1e0cbbcb234d3308762fe65.

As swanky as it is to have a really short file, it's hard to justify and
makes me nervous.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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>