]> git.ipfire.org Git - thirdparty/wireguard-tools.git/log
thirdparty/wireguard-tools.git
5 years agoextract-{handshakes,keys}: rework for upstream kernel
Jason A. Donenfeld [Fri, 31 Jan 2020 23:48:25 +0000 (00:48 +0100)] 
extract-{handshakes,keys}: rework for upstream kernel

Now that WireGuard has been upstreamed and the repos split, we have to
look elsewhere for these headers.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoman: document dynamic debug trick for Linux
Jason A. Donenfeld [Fri, 31 Jan 2020 22:17:12 +0000 (23:17 +0100)] 
man: document dynamic debug trick for Linux

This comes up occasionally, so it may be useful to mention its
possibility in the man page. At least the Arch Linux and Ubuntu kernels
support dynamic debugging, so this advise will at least help somebody.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: android: split uids into multiple commands
Jason A. Donenfeld [Fri, 31 Jan 2020 17:56:52 +0000 (18:56 +0100)] 
wg-quick: android: split uids into multiple commands

Different versions of netd have different limits on how many can be
passed at once.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Alexey <zaranecc@bk.ru>
5 years agoversion: bump v1.0.20200121
Jason A. Donenfeld [Tue, 21 Jan 2020 14:51:31 +0000 (15:51 +0100)] 
version: bump

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: sort inputs to linker so that build is reproducible
Jason A. Donenfeld [Tue, 21 Jan 2020 12:05:42 +0000 (13:05 +0100)] 
Makefile: sort inputs to linker so that build is reproducible

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agonetlink: make sure to clear return value when trying again
Jason A. Donenfeld [Sat, 11 Jan 2020 17:16:13 +0000 (12:16 -0500)] 
netlink: make sure to clear return value when trying again

Otherwise this runs in an infinite loop if at some point a dump was
interrupted.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agofuzz: add set and setconf fuzzers
Jason A. Donenfeld [Sat, 11 Jan 2020 15:28:19 +0000 (16:28 +0100)] 
fuzz: add set and setconf fuzzers

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: evaluate git version lazily
Jason A. Donenfeld [Wed, 8 Jan 2020 22:59:58 +0000 (17:59 -0500)] 
Makefile: evaluate git version lazily

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agofuzz: add generic command argument fuzzer
Jason A. Donenfeld [Sat, 4 Jan 2020 14:34:28 +0000 (15:34 +0100)] 
fuzz: add generic command argument fuzzer

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoipc: simplify inflatable buffer and add fuzzer
Jason A. Donenfeld [Sat, 4 Jan 2020 13:46:27 +0000 (14:46 +0100)] 
ipc: simplify inflatable buffer and add fuzzer

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: add standard 'all' target
Jason A. Donenfeld [Fri, 3 Jan 2020 20:22:22 +0000 (21:22 +0100)] 
Makefile: add standard 'all' target

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Bruno Wolff III <bruno@wolff.to>
5 years agoMakefile: remove pwd from compile output
Jason A. Donenfeld [Fri, 3 Jan 2020 11:36:10 +0000 (12:36 +0100)] 
Makefile: remove pwd from compile output

We previously included $(pwd) in the compile output pretty printer,
because it matched our parent out-of-tree module build. Since we're no
longer coupled to the module, we can return to a prettier scheme of just
using the object name.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Fixes: eb68ad07 ("Makefile: even prettier output")
5 years agoversion: bump v1.0.20200102
Jason A. Donenfeld [Thu, 2 Jan 2020 18:53:11 +0000 (19:53 +0100)] 
version: bump

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoglobal: bump copyright
Jason A. Donenfeld [Thu, 2 Jan 2020 18:52:25 +0000 (19:52 +0100)] 
global: bump copyright

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: quote ifname for nft
Jason A. Donenfeld [Sat, 28 Dec 2019 17:35:12 +0000 (18:35 +0100)] 
wg-quick: linux: quote ifname for nft

Otherwise nft(8) has strange ideas of what a string is.

Suggested-by: RistiCore <RistiCore@mail.ee>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: rework automatic version.h mangling
Jason A. Donenfeld [Fri, 27 Dec 2019 17:17:00 +0000 (18:17 +0100)] 
Makefile: rework automatic version.h mangling

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Joe Doss <joe@solidadmin.com>
5 years agofuzz: find bugs when parsing uapi input
Jason A. Donenfeld [Fri, 27 Dec 2019 13:57:09 +0000 (14:57 +0100)] 
fuzz: find bugs when parsing uapi input

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agofuzz: find bugs in the config syntax parser
Jason A. Donenfeld [Fri, 27 Dec 2019 12:40:26 +0000 (13:40 +0100)] 
fuzz: find bugs in the config syntax parser

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoman: add documentation about removing explicit listen-port
Devin Smith [Fri, 27 Dec 2019 03:35:26 +0000 (21:35 -0600)] 
man: add documentation about removing explicit listen-port

Signed-off-by: Devin Smith <thundza@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agodns-hatchet: adjust path for new repo layout
Jason A. Donenfeld [Thu, 26 Dec 2019 17:10:37 +0000 (18:10 +0100)] 
dns-hatchet: adjust path for new repo layout

Reported-by: Joe Doss <joe@solidadmin.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: port static analysis check
Jason A. Donenfeld [Thu, 26 Dec 2019 15:54:25 +0000 (16:54 +0100)] 
Makefile: port static analysis check

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: DEBUG_TOOLS -> DEBUG and document
Jason A. Donenfeld [Thu, 26 Dec 2019 15:50:55 +0000 (16:50 +0100)] 
Makefile: DEBUG_TOOLS -> DEBUG and document

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agosystemd: update documentation URL
Jason A. Donenfeld [Thu, 26 Dec 2019 12:57:22 +0000 (13:57 +0100)] 
systemd: update documentation URL

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoversion: bump v1.0.20191226
Jason A. Donenfeld [Thu, 26 Dec 2019 12:59:11 +0000 (13:59 +0100)] 
version: bump

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoMakefile: add git versioning to dev builds
Jason A. Donenfeld [Thu, 26 Dec 2019 12:01:00 +0000 (13:01 +0100)] 
Makefile: add git versioning to dev builds

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoREADME: consolidate with INSTALL and rewrite
Jason A. Donenfeld [Thu, 26 Dec 2019 11:19:23 +0000 (12:19 +0100)] 
README: consolidate with INSTALL and rewrite

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg: include tools version
Jason A. Donenfeld [Thu, 26 Dec 2019 11:30:12 +0000 (12:30 +0100)] 
wg: include tools version

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg: add back source formerly shared with kernel module
Jason A. Donenfeld [Thu, 26 Dec 2019 11:09:53 +0000 (12:09 +0100)] 
wg: add back source formerly shared with kernel module

We used to reach back into parent directories for this, but with the
repo split, we now require our own copy.

We use -idirafter in case system headers are installed for the
wireguard.h netlink definitions.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agogitignore: trim down to basics
Jason A. Donenfeld [Thu, 26 Dec 2019 11:02:11 +0000 (12:02 +0100)] 
gitignore: trim down to basics

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: use already configured addresses instead of in-memory
Jason A. Donenfeld [Tue, 17 Dec 2019 13:14:13 +0000 (14:14 +0100)] 
wg-quick: linux: use already configured addresses instead of in-memory

The ADDRESSES array might not have addresses added during PreUp. But
moreover, nft(8) and iptables(8) don't like ip addresses in the form
somev6prefix::someipv4suffix, such as fd00::1.2.3.4, while ip(8) can
handle it. So by adding these first and then asking for them back, we
always get normalized addresses suitable for nft(8) and iptables(8).

Reported-by: Silvan Nagl <mail@53c70r.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg: adjust wg.8 syntax for consistency in COMMANDS section
Kai Haberzettl [Fri, 13 Dec 2019 07:42:30 +0000 (08:42 +0100)] 
wg: adjust wg.8 syntax for consistency in COMMANDS section

Signed-off-by: Kai Haberzettl <khaberz@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: try both iptables(8) and nft(8) on teardown
Jason A. Donenfeld [Thu, 12 Dec 2019 16:24:04 +0000 (17:24 +0100)] 
wg-quick: linux: try both iptables(8) and nft(8) on teardown

Daniel argues that technically a package manager could install nft(8)
after previously having started wg-quick(8) using iptables(8).

Suggested-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: support older nft(8)
Jason A. Donenfeld [Tue, 10 Dec 2019 21:51:40 +0000 (22:51 +0100)] 
wg-quick: linux: support older nft(8)

Older nft(8), such as that on Ubuntu, does not accept the - parameter to
the -f argument and doesn't accept symbolic priority names. So instead
use the canonical numeric priority forms and use <(echo) instead of -.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoglobal: fix up spelling
Josh Soref [Tue, 10 Dec 2019 16:22:58 +0000 (17:22 +0100)] 
global: fix up spelling

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: add support for nft and prefer it
Jason A. Donenfeld [Tue, 10 Dec 2019 15:37:34 +0000 (16:37 +0100)] 
wg-quick: linux: add support for nft and prefer it

If nft(8) is installed, use it. These rules should be identical to the
iptables-restore(8) ones, with the advantage that cleanup is easy
because we use custom table names.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: ignore save warnings for iptables-nft
Jason A. Donenfeld [Fri, 6 Dec 2019 15:51:05 +0000 (16:51 +0100)] 
wg-quick: linux: ignore save warnings for iptables-nft

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: suppress more warnings on weird kernels
Jason A. Donenfeld [Fri, 6 Dec 2019 15:22:18 +0000 (16:22 +0100)] 
wg-quick: linux: suppress more warnings on weird kernels

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: some iptables don't like empty lines
Jason A. Donenfeld [Thu, 5 Dec 2019 17:33:15 +0000 (18:33 +0100)] 
wg-quick: linux: some iptables don't like empty lines

Reported-by: Kenneth R. Crudup <kenny@panix.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: iptables-* -w is not widely supported
Jason A. Donenfeld [Thu, 5 Dec 2019 10:47:57 +0000 (11:47 +0100)] 
wg-quick: linux: iptables-* -w is not widely supported

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoipc: make sure userspace communication frees wgdevice
Jason A. Donenfeld [Mon, 2 Dec 2019 18:19:38 +0000 (19:19 +0100)] 
ipc: make sure userspace communication frees wgdevice

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: have remove_iptables return true
Jason A. Donenfeld [Thu, 28 Nov 2019 17:15:41 +0000 (18:15 +0100)] 
wg-quick: linux: have remove_iptables return true

Reported-by: Thomas Sattler <sattler@med.uni-frankfurt.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: ensure postdown hooks execute
Jason A. Donenfeld [Thu, 28 Nov 2019 12:49:34 +0000 (13:49 +0100)] 
wg-quick: linux: ensure postdown hooks execute

Reported-by: Thomas Sattler <sattler@med.uni-frankfurt.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: suppress error when finding unused table
Jason A. Donenfeld [Wed, 27 Nov 2019 16:12:08 +0000 (17:12 +0100)] 
wg-quick: linux: suppress error when finding unused table

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg: add syncconf command
Jason A. Donenfeld [Tue, 11 Jun 2019 17:22:52 +0000 (19:22 +0200)] 
wg: add syncconf command

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agoreresolve-dns: remove invalid anchors on regex match
Jason A. Donenfeld [Wed, 27 Nov 2019 12:30:43 +0000 (13:30 +0100)] 
reresolve-dns: remove invalid anchors on regex match

Reported-by: Conrad Meyer <cem@freebsd.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: filter bogus injected packets and don't disable rpfilter
Jason A. Donenfeld [Thu, 21 Nov 2019 10:19:43 +0000 (11:19 +0100)] 
wg-quick: linux: filter bogus injected packets and don't disable rpfilter

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: only touch net.ipv4 for v4
Jason A. Donenfeld [Thu, 21 Nov 2019 09:53:45 +0000 (10:53 +0100)] 
wg-quick: linux: only touch net.ipv4 for v4

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: android: check for null in binder cleanup functions
Jason A. Donenfeld [Wed, 16 Oct 2019 12:23:27 +0000 (14:23 +0200)] 
wg-quick: android: check for null in binder cleanup functions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: android: use Binder for setting DNS on Android 10
Nicolas Douma [Wed, 2 Oct 2019 19:10:51 +0000 (21:10 +0200)] 
wg-quick: android: use Binder for setting DNS on Android 10

Signed-off-by: Nicolas Douma <nicolas@serveur.io>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg: windows: enforce named pipe ownership and use protected prefix
Jason A. Donenfeld [Fri, 30 Aug 2019 19:51:27 +0000 (13:51 -0600)] 
wg: windows: enforce named pipe ownership and use protected prefix

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: linux: don't fail down when using systemd-resolved
Ronan Pigott [Wed, 28 Aug 2019 01:42:14 +0000 (18:42 -0700)] 
wg-quick: linux: don't fail down when using systemd-resolved

systemd-resolved has a compatibility interface for use with resolvconf
scripts when resolvectl is called from a symlink from resolvconf.
However, when tearing down the interface, cmd_down calls del_if and then
unset_dns. In the case of systemd-resolved, deleting the interface also
removes the systemd-resolved entry and causes resolvconf -d to fail when
resolvconf really is a symlink to resolvectl. This causes `wg-quick
down` and 'wg-quick@.service' to exit with failure.

Instead we use the resolvconf '-f' flag to ignore non-existent
interfaces, supported by both openresolv and sd-resolved resolvconf.

Signed-off-by: Ronan Pigott <rpigott@berkeley.edu>
[zx2c4: moved -f argument to end to remain compatible with Debian's resolvconf]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
5 years agowg-quick: openbsd: fix alternate routing table syntax
Ankur Kothari [Mon, 5 Aug 2019 22:57:28 +0000 (08:57 +1000)] 
wg-quick: openbsd: fix alternate routing table syntax

route(8) has always used the `-T` option to specify the
routing table; there is no `rdomain` option.

Signed-off-by: Ankur Kothari <ankur@lipidity.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: android: refactor and add incoming allow rules
Jason A. Donenfeld [Mon, 8 Jul 2019 10:56:41 +0000 (12:56 +0200)] 
wg-quick: android: refactor and add incoming allow rules

Suggested-by: Yağmur Oymak <yagmur.oymak@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: darwin: support being called from launchd
Jason A. Donenfeld [Wed, 19 Jun 2019 11:18:34 +0000 (13:18 +0200)] 
wg-quick: darwin: support being called from launchd

This causes wg-quick up to wait for the monitor to exit before it exits,
so that launchd can correctly wait on it.

Reported-by: Cameron Palmer <cameron@promon.no>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: pass WG_ENDPOINT_RESOLUTION_RETRIES=infinity to systemd unit
Jason A. Donenfeld [Fri, 31 May 2019 19:10:41 +0000 (21:10 +0200)] 
wg: pass WG_ENDPOINT_RESOLUTION_RETRIES=infinity to systemd unit

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: add wincompat layer to wg(8)
Jason A. Donenfeld [Sat, 11 May 2019 17:34:19 +0000 (19:34 +0200)] 
wg: add wincompat layer to wg(8)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: allow setting WG_ENDPOINT_RESOLUTION_RETRIES
Jason A. Donenfeld [Tue, 28 May 2019 20:45:15 +0000 (22:45 +0200)] 
wg: allow setting WG_ENDPOINT_RESOLUTION_RETRIES

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: specify protocol to ip(8), because of inconsistencies
Jason A. Donenfeld [Fri, 17 May 2019 15:30:38 +0000 (17:30 +0200)] 
wg-quick: specify protocol to ip(8), because of inconsistencies

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: look up existing routes properly
Jason A. Donenfeld [Fri, 17 May 2019 10:32:46 +0000 (12:32 +0200)] 
wg-quick: look up existing routes properly

This was never really correct, and then 5.1 broke it entirely.

Reported-by: piraty1@inbox.ru
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: make darwin and freebsd path search strict like linux
Jason A. Donenfeld [Tue, 23 Apr 2019 09:16:16 +0000 (18:16 +0900)] 
wg-quick: make darwin and freebsd path search strict like linux

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel
Jason A. Donenfeld [Sun, 21 Apr 2019 01:11:36 +0000 (10:11 +0900)] 
wg-quick: freebsd: workaround SIOCGIFSTATUS race in FreeBSD kernel

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: avoid unneccessary next_peer assignments in sort_peers()
Luis Ressel [Sat, 23 Mar 2019 00:31:19 +0000 (01:31 +0100)] 
wg: avoid unneccessary next_peer assignments in sort_peers()

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: add 'strip' subcommand
Luis Ressel [Wed, 13 Mar 2019 23:36:22 +0000 (00:36 +0100)] 
wg-quick: add 'strip' subcommand

`wg-quick strip` prints the config file to stdout after stripping it of
all wg-quick-specific options.

This enables tricks such as `wg addconf $DEV <(wg-quick strip $DEV)`.

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: warn if an AllowedIP has a nonzero host part
Luis Ressel [Sat, 16 Mar 2019 23:02:32 +0000 (00:02 +0100)] 
wg: warn if an AllowedIP has a nonzero host part

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: freebsd: export TMPDIR when restoring and don't make empty
Jason A. Donenfeld [Mon, 18 Mar 2019 20:41:10 +0000 (14:41 -0600)] 
wg-quick: freebsd: export TMPDIR when restoring and don't make empty

Otherwise mktemp doesn't see it, and if it's empty we wind up in /.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: add support for Haiku
Alexander von Gluck IV [Thu, 28 Feb 2019 16:23:45 +0000 (10:23 -0600)] 
wg: add support for Haiku

Signed-off-by: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: genkey: account for short reads of /dev/urandom
Jason A. Donenfeld [Thu, 28 Feb 2019 22:37:24 +0000 (23:37 +0100)] 
wg: genkey: account for short reads of /dev/urandom

Apparently Haiku has a misbehaving /dev/urandom.

While we're at it, simplify the function signature to completely succeed
or completely fail and make sure the caller checks the result.

Reported-by: Alexander von Gluck IV <kallisti5@unixzen.com>
Nitpicked-by: Aaron Jones <aaronmdjones@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: freebsd: rebreak interface loopback, while fixing localhost
Jason A. Donenfeld [Thu, 28 Feb 2019 18:03:11 +0000 (19:03 +0100)] 
wg-quick: freebsd: rebreak interface loopback, while fixing localhost

The commit 7c833642 ("wg-quick: freebsd: allow loopback to work") was
supposed to make things better, but actually it just started sending
legitimate localhost traffic over the WireGuard interface, which is
really quite bad.

This reverts commit 7c833642dfa342218602ab18e7091e86408d2982.

Reported-by: Matt Smith <matt.xtaz@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: c_acc doesn't need to be initialized
Jason A. Donenfeld [Fri, 8 Feb 2019 01:32:15 +0000 (02:32 +0100)] 
wg: c_acc doesn't need to be initialized

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: fight compiler slightly harder
Jason A. Donenfeld [Tue, 5 Feb 2019 00:00:52 +0000 (01:00 +0100)] 
wg: fight compiler slightly harder

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agonoise: store clamped key instead of raw key
Jason A. Donenfeld [Sun, 3 Feb 2019 20:50:54 +0000 (21:50 +0100)] 
noise: store clamped key instead of raw key

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agohighlighter: when subtracting char, cast to unsigned
Jason A. Donenfeld [Thu, 31 Jan 2019 01:03:10 +0000 (02:03 +0100)] 
highlighter: when subtracting char, cast to unsigned

Windows.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agosystemd: wg-quick should depend on nss-lookup.target
Jason A. Donenfeld [Wed, 30 Jan 2019 17:53:37 +0000 (18:53 +0100)] 
systemd: wg-quick should depend on nss-lookup.target

Since wg-quick(8) calls wg(8) which does hostname lookups, we should
probably only run this after we're allowed to look up hostnames.

Reported-by: Anton Castelli <anton.c42@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: remove unused check phony declaration
Jason A. Donenfeld [Thu, 24 Jan 2019 17:14:38 +0000 (18:14 +0100)] 
wg: remove unused check phony declaration

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: freebsd: allow loopback to work
Jason A. Donenfeld [Thu, 24 Jan 2019 02:26:51 +0000 (03:26 +0100)] 
wg-quick: freebsd: allow loopback to work

FreeBSD adds a route for point-to-point destination addresses. We don't
really want to specify any destination address, but unfortunately we
have to. Before we tried to cheat by giving our own address as the
destination, but this had the unfortunate effect of preventing
loopback from working on our local ip address. We work around this with
yet another kludge: we set the destination address to 127.0.0.1. Since
127.0.0.1 is already assigned to an interface, this has the same effect
of not specifying a destination address, and therefore we accomplish the
intended behavior.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agonetlink: use __kernel_timespec for handshake time
Jason A. Donenfeld [Tue, 22 Jan 2019 12:38:52 +0000 (13:38 +0100)] 
netlink: use __kernel_timespec for handshake time

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocontrib: introduce simple highlighter library
Jason A. Donenfeld [Sat, 5 Jan 2019 16:02:14 +0000 (17:02 +0100)] 
contrib: introduce simple highlighter library

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoglobal: normalize -> clamp
Jason A. Donenfeld [Fri, 11 Jan 2019 09:13:35 +0000 (01:13 -0800)] 
global: normalize -> clamp

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agokeygen-html: bring back pure javascript implementation
Jason A. Donenfeld [Thu, 26 Jul 2018 18:05:47 +0000 (20:05 +0200)] 
keygen-html: bring back pure javascript implementation

This reverts commit 9d5baf7d1d14ca7eb0852b41566330259229d489.

Benoît Viguier has proofs that values will stay well within 2^53. We
also have an improved carry function that's much simpler.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoKconfig: IPsec isn't IPSec
Jason A. Donenfeld [Tue, 8 Jan 2019 02:03:39 +0000 (18:03 -0800)] 
Kconfig: IPsec isn't IPSec

Reported-by: Raf Czlonka <rczlonka@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoglobal: update copyright
Jason A. Donenfeld [Wed, 2 Jan 2019 00:58:10 +0000 (01:58 +0100)] 
global: update copyright

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: curve25519: handle unaligned loads/stores safely
Jason A. Donenfeld [Thu, 20 Dec 2018 17:30:21 +0000 (18:30 +0100)] 
wg: curve25519: handle unaligned loads/stores safely

Reported-by: Chris Hewitt <chris@chrishewitt.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agomakefile: use immediate expansion and use correct template patterns
Jason A. Donenfeld [Sat, 15 Dec 2018 23:50:39 +0000 (00:50 +0100)] 
makefile: use immediate expansion and use correct template patterns

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: bring interface up while setting MTU
Aaron Jones [Sun, 16 Dec 2018 21:04:02 +0000 (21:04 +0000)] 
wg-quick: bring interface up while setting MTU

This avoids another ip(8) invocation for little benefit.
Confirmed to work with iproute2 and busybox.

Signed-off-by: Aaron Jones <aaronmdjones@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoembeddable-wg-library: do not warn on unrecognized netlink attributes
Jason A. Donenfeld [Fri, 7 Dec 2018 04:36:26 +0000 (05:36 +0100)] 
embeddable-wg-library: do not warn on unrecognized netlink attributes

This is a follow up of bcf8684c9ec90fe0d283a67d1654d05fb3eae019.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoglobal: various formatting tweeks
Jason A. Donenfeld [Mon, 12 Nov 2018 03:35:07 +0000 (22:35 -0500)] 
global: various formatting tweeks

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: android: do not choke on empty allowed-ips
Jason A. Donenfeld [Mon, 12 Nov 2018 03:11:56 +0000 (22:11 -0500)] 
wg-quick: android: do not choke on empty allowed-ips

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agokeygen-html: add missing glue macro
Jason A. Donenfeld [Tue, 6 Nov 2018 02:30:06 +0000 (03:30 +0100)] 
keygen-html: add missing glue macro

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg.8: AllowedIPs isn't actually required
Jason A. Donenfeld [Fri, 19 Oct 2018 01:35:25 +0000 (03:35 +0200)] 
wg.8: AllowedIPs isn't actually required

An empty allowed IPs is totally valid, for folks wishing to move IP
addresses between multiple peers atomically.

Suggested-by: Comex <comexk@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg.8: specify that wg(8) shows runtime info too
Jason A. Donenfeld [Fri, 19 Oct 2018 01:33:53 +0000 (03:33 +0200)] 
wg.8: specify that wg(8) shows runtime info too

Suggested-by: Comex <comexk@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick: wait for interface to disappear on freebsd
Jason A. Donenfeld [Fri, 12 Oct 2018 14:55:35 +0000 (16:55 +0200)] 
wg-quick: wait for interface to disappear on freebsd

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: don't fail if a netlink interface dump is inconsistent
Jason A. Donenfeld [Fri, 12 Oct 2018 14:40:29 +0000 (16:40 +0200)] 
wg: don't fail if a netlink interface dump is inconsistent

Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed
during the dump. That's unfortunate, but is pretty common on busy
systems that are adding and removing tunnels all the time. Rather
than retrying, potentially indefinitely, we just work with the
partial results.

Reported-by: Robert Gerus <ar@is-a.cat>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: compile on gnu99
Jason A. Donenfeld [Tue, 9 Oct 2018 13:23:42 +0000 (15:23 +0200)] 
wg: compile on gnu99

We don't actually use any C11 features, so we can at least compile with
ancient gcc.

Reported-by: Aaron M. D. Jones <aaronmdjones@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg: use libc's endianness macro if no compiler macro
Jason A. Donenfeld [Tue, 9 Oct 2018 13:21:27 +0000 (15:21 +0200)] 
wg: use libc's endianness macro if no compiler macro

This lets us be compiled with ancient gcc.

Reported-by: Jeff Brandt <jeff@jeffcolo.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoglobal: rename struct wireguard_ to struct wg_
Jason A. Donenfeld [Mon, 8 Oct 2018 01:36:20 +0000 (03:36 +0200)] 
global: rename struct wireguard_ to struct wg_

This required a bit of pruning of our christmas trees.

Suggested-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agonetlink: do not stuff index into nla type
Jason A. Donenfeld [Mon, 8 Oct 2018 01:06:47 +0000 (03:06 +0200)] 
netlink: do not stuff index into nla type

It's not used for anything, and LKML doesn't like the type being used as
an index value.

Suggested-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocrypto: clean up remaining .h->.c
Jason A. Donenfeld [Sun, 7 Oct 2018 13:35:51 +0000 (15:35 +0200)] 
crypto: clean up remaining .h->.c

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agowg-quick.8: add policy routing example
Jason A. Donenfeld [Fri, 5 Oct 2018 17:19:08 +0000 (19:19 +0200)] 
wg-quick.8: add policy routing example

Suggested-by: Toke Høiland-Jørgensen <toke@toke.dk>
Suggested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agocrypto: make constant naming scheme consistent
Jason A. Donenfeld [Mon, 24 Sep 2018 20:02:13 +0000 (22:02 +0200)] 
crypto: make constant naming scheme consistent

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoglobal: put SPDX identifier on its own line
Jason A. Donenfeld [Wed, 19 Sep 2018 23:49:47 +0000 (01:49 +0200)] 
global: put SPDX identifier on its own line

The kernel has very specific rules correlating file type with comment
type, and also SPDX identifiers can't be merged with other comments.

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