]> git.ipfire.org Git - thirdparty/wireguard-tools.git/log
thirdparty/wireguard-tools.git
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>
8 years agoexternal-tests: add keepalive packet
Jason A. Donenfeld [Thu, 1 Jun 2017 16:45:20 +0000 (18:45 +0200)] 
external-tests: add keepalive packet

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agogo test: properly pad message
Jason A. Donenfeld [Thu, 1 Jun 2017 04:31:26 +0000 (06:31 +0200)] 
go test: properly pad message

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: allow creating device with no peers
Jason A. Donenfeld [Tue, 30 May 2017 03:14:53 +0000 (05:14 +0200)] 
wg: allow creating device with no peers

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agorust test: add icmp ping
Jason A. Donenfeld [Mon, 29 May 2017 14:58:10 +0000 (16:58 +0200)] 
rust test: add icmp ping

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agorust test: convert screech test to snow
Jake McGinty [Mon, 29 May 2017 05:47:26 +0000 (13:47 +0800)] 
rust test: convert screech test to snow

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoman: update wg-quick(8) to show Debian resolvconf braindamage
Jason A. Donenfeld [Mon, 22 May 2017 11:28:02 +0000 (13:28 +0200)] 
man: update wg-quick(8) to show Debian resolvconf braindamage

While OpenResolv supports explicit ordering directives such as `-m` and
exclusivity directives such as `-x`, Debian's own resolvconf supports
none of this, instead using a hard coded list of interface name
templates for determining ordering. While trying to emulate `-x` is
difficult [*], we can at least try to mostly emulate `-m 0` by
masquerading as a `tun*` interface to resolvconf. Ugly, but it works.

[*] One heavy handed way of emulating `-x` would be something like:

   # echo nameserver 8.8.8.8 > /etc/resolv.conf.wg0-exclusive
   # mount --bind -o ro /etc/resolv.conf.wg0-exclusive /etc/resolv.conf
   # rm -f /etc/resolv.conf.wg0-exclusive

This in practice works quite well, but is a bit heavy to put in a man
page. It also doesn't "stack" well. For example, if we simply run
`umount /etc/resolv.conf`, how do we know which resolv.conf entry we're
unmounting?

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: use src routing for default routes in v6
Jason A. Donenfeld [Thu, 18 May 2017 12:40:26 +0000 (14:40 +0200)] 
wg-quick: use src routing for default routes in v6

Otherwise, traffic is sent with the IP address of a different interface,
and then packets don't actually get delivered.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoman: fix psk mention in wg-quick man page
Jason A. Donenfeld [Thu, 18 May 2017 11:37:31 +0000 (13:37 +0200)] 
man: fix psk mention in wg-quick man page

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: opt-in globally to GNU-isms to keep the BSDs happy
Jason A. Donenfeld [Wed, 17 May 2017 16:34:23 +0000 (18:34 +0200)] 
wg: opt-in globally to GNU-isms to keep the BSDs happy

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: support text-based ipc
Jason A. Donenfeld [Mon, 15 May 2017 21:24:48 +0000 (23:24 +0200)] 
wg: support text-based ipc

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: check for proto error on set too
Jason A. Donenfeld [Sun, 14 May 2017 17:29:59 +0000 (19:29 +0200)] 
wg: check for proto error on set too

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: stricter key file reading
Jason A. Donenfeld [Fri, 12 May 2017 13:03:38 +0000 (15:03 +0200)] 
wg: stricter key file reading

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agonoise: redesign preshared key mode
Jason A. Donenfeld [Thu, 27 Apr 2017 09:10:50 +0000 (11:10 +0200)] 
noise: redesign preshared key mode

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: auto MTU discovery
Jason A. Donenfeld [Mon, 24 Apr 2017 03:01:16 +0000 (05:01 +0200)] 
wg-quick: auto MTU discovery

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: retry name resolution on temporary failure
Jason A. Donenfeld [Mon, 24 Apr 2017 01:45:40 +0000 (03:45 +0200)] 
wg: retry name resolution on temporary failure

This should solve many problems at init time.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: no hyphen in preshared, to keep uniformity
Jason A. Donenfeld [Thu, 20 Apr 2017 18:21:50 +0000 (20:21 +0200)] 
wg: no hyphen in preshared, to keep uniformity

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: argc is always 1
Jason A. Donenfeld [Wed, 19 Apr 2017 14:53:13 +0000 (16:53 +0200)] 
wg: argc is always 1

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: check for malloc failure
Jason A. Donenfeld [Wed, 19 Apr 2017 14:51:24 +0000 (16:51 +0200)] 
wg: check for malloc failure

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: side channel resistant base64
Jason A. Donenfeld [Sat, 15 Apr 2017 23:20:43 +0000 (01:20 +0200)] 
wg: side channel resistant base64

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: do not use addrconfig with port in gai
Jason A. Donenfeld [Tue, 28 Mar 2017 08:46:31 +0000 (10:46 +0200)] 
wg: do not use addrconfig with port in gai

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agouapi: add version magic
Jason A. Donenfeld [Fri, 24 Mar 2017 03:01:25 +0000 (04:01 +0100)] 
uapi: add version magic

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: various cleanups
Jason A. Donenfeld [Thu, 23 Mar 2017 14:44:10 +0000 (15:44 +0100)] 
wg-quick: various cleanups

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: document # comments in wg(8) man page
Jason A. Donenfeld [Wed, 22 Mar 2017 12:11:41 +0000 (13:11 +0100)] 
wg: document # comments in wg(8) man page

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: support old ip(8)
Pim van Pelt [Thu, 16 Mar 2017 22:57:55 +0000 (23:57 +0100)] 
wg-quick: support old ip(8)

Old versions of ip(8) do not accept arguments to `ip rule show.` This
patch works around that limitation.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agocontrib: add wg-json utility
Jason A. Donenfeld [Thu, 23 Feb 2017 14:50:05 +0000 (15:50 +0100)] 
contrib: add wg-json utility

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: fix bash completion spaces
Jason A. Donenfeld [Thu, 23 Feb 2017 03:39:06 +0000 (04:39 +0100)] 
wg: fix bash completion spaces

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add wg show [interface] dump
Jason A. Donenfeld [Wed, 22 Feb 2017 20:53:55 +0000 (21:53 +0100)] 
wg: add wg show [interface] dump

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: give "off" value for fwmark
Jason A. Donenfeld [Wed, 22 Feb 2017 20:45:03 +0000 (21:45 +0100)] 
wg: give "off" value for fwmark

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: allow config files without trailing newline
Jason A. Donenfeld [Wed, 22 Feb 2017 19:23:00 +0000 (20:23 +0100)] 
wg-quick: allow config files without trailing newline

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoextract-keys: respect compat directives
Jason A. Donenfeld [Mon, 20 Feb 2017 20:55:44 +0000 (21:55 +0100)] 
extract-keys: respect compat directives

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: unquote fwmark for bash 4.3
Jason A. Donenfeld [Tue, 14 Feb 2017 10:41:56 +0000 (11:41 +0100)] 
wg-quick: unquote fwmark for bash 4.3

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: set LC_ALL for consistent regex
Jason A. Donenfeld [Sun, 5 Feb 2017 22:05:12 +0000 (23:05 +0100)] 
wg-quick: set LC_ALL for consistent regex

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agosocket: enable setting of fwmark
Jason A. Donenfeld [Tue, 24 Jan 2017 16:43:35 +0000 (17:43 +0100)] 
socket: enable setting of fwmark

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agosocket: general ephemeral ports instead of name-based ports
Jason A. Donenfeld [Tue, 24 Jan 2017 04:59:17 +0000 (05:59 +0100)] 
socket: general ephemeral ports instead of name-based ports

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: support v6 dual stack
Jason A. Donenfeld [Tue, 24 Jan 2017 04:28:03 +0000 (05:28 +0100)] 
wg-quick: support v6 dual stack

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: remove key for any empty file
Jason A. Donenfeld [Tue, 24 Jan 2017 03:20:05 +0000 (04:20 +0100)] 
wg: remove key for any empty file

Rather than just using /dev/null to mean key removal, match on any empty
file, so that this interface is cross platform.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: setconf should remove existing psk
Jason A. Donenfeld [Tue, 24 Jan 2017 03:11:56 +0000 (04:11 +0100)] 
wg: setconf should remove existing psk

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: recommend using resolvconf in exclusive mode
Jason A. Donenfeld [Wed, 18 Jan 2017 23:07:31 +0000 (00:07 +0100)] 
wg-quick: recommend using resolvconf in exclusive mode

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: man: recommend correct port
Jason A. Donenfeld [Sun, 15 Jan 2017 21:22:45 +0000 (22:22 +0100)] 
wg: man: recommend correct port

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: parse IPv6 endpoints correctly
Jason A. Donenfeld [Sun, 15 Jan 2017 12:01:06 +0000 (13:01 +0100)] 
wg-quick: parse IPv6 endpoints correctly

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: better removal of suppress_prefix rule
Jason A. Donenfeld [Tue, 10 Jan 2017 23:29:58 +0000 (00:29 +0100)] 
wg-quick: better removal of suppress_prefix rule

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoUpdate copyright
Jason A. Donenfeld [Tue, 10 Jan 2017 05:36:19 +0000 (06:36 +0100)] 
Update copyright

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agouapi: use sockaddr union instead of sockaddr_storage
Jason A. Donenfeld [Tue, 10 Jan 2017 04:52:06 +0000 (05:52 +0100)] 
uapi: use sockaddr union instead of sockaddr_storage

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agouapi: use flag instead of C bitfield for portability
Jason A. Donenfeld [Tue, 10 Jan 2017 03:47:29 +0000 (19:47 -0800)] 
uapi: use flag instead of C bitfield for portability

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: ipc: read from socket incrementally
Jason A. Donenfeld [Tue, 10 Jan 2017 03:50:42 +0000 (04:50 +0100)] 
wg: ipc: read from socket incrementally

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: error on short ret reads
Jason A. Donenfeld [Sun, 8 Jan 2017 22:00:41 +0000 (23:00 +0100)] 
wg: error on short ret reads

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-quick: enforce good permissions
Jason A. Donenfeld [Thu, 5 Jan 2017 18:57:50 +0000 (19:57 +0100)] 
wg-quick: enforce good permissions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add installation note for distros
Jason A. Donenfeld [Thu, 5 Jan 2017 18:41:20 +0000 (19:41 +0100)] 
wg: add installation note for distros

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: remove DESTDIR for autodetection
Christian Hesse [Wed, 4 Jan 2017 20:14:16 +0000 (21:14 +0100)] 
wg: remove DESTDIR for autodetection

DESTDIR is always empty, no need to check anything there. Check the main
system instead.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add systemd unit and auto-detection
Jason A. Donenfeld [Wed, 4 Jan 2017 18:28:28 +0000 (19:28 +0100)] 
wg: add systemd unit and auto-detection

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add makefile instructions
Jason A. Donenfeld [Wed, 4 Jan 2017 17:20:08 +0000 (18:20 +0100)] 
wg: add makefile instructions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add wg-quick
Jason A. Donenfeld [Mon, 2 Jan 2017 04:33:43 +0000 (05:33 +0100)] 
wg: add wg-quick

This is based on wg-config, but is even easier to use, and now makes
our full tools suite.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: add bash completion for wg(8)
Jason A. Donenfeld [Wed, 4 Jan 2017 06:05:56 +0000 (07:05 +0100)] 
wg: add bash completion for wg(8)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agocontrib: slight ncat tweak
Jason A. Donenfeld [Tue, 3 Jan 2017 04:23:17 +0000 (05:23 +0100)] 
contrib: slight ncat tweak

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: syscall.h should actually be sys/syscall.h
Jason A. Donenfeld [Fri, 30 Dec 2016 16:53:05 +0000 (17:53 +0100)] 
wg: syscall.h should actually be sys/syscall.h

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-config: use ip rules instead of tungate
Jason A. Donenfeld [Fri, 30 Dec 2016 16:50:19 +0000 (17:50 +0100)] 
wg-config: use ip rules instead of tungate

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoexternal-tests: update to latest
Jason A. Donenfeld [Sun, 25 Dec 2016 20:01:06 +0000 (21:01 +0100)] 
external-tests: update to latest

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: rename 'bandwidth' to 'transfer' in output
Tomasz Torcz [Fri, 23 Dec 2016 19:25:55 +0000 (20:25 +0100)] 
wg: rename 'bandwidth' to 'transfer' in output

'bandwidth' is a measure of speed, but wg's output shows only the
number of bytes transferred. Thus 'transfer' is a better label.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-config: cleanups
Jason A. Donenfeld [Wed, 21 Dec 2016 05:15:57 +0000 (06:15 +0100)] 
wg-config: cleanups

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: do not use AI_ADDRCONFIG
Jason A. Donenfeld [Tue, 20 Dec 2016 20:50:29 +0000 (21:50 +0100)] 
wg: do not use AI_ADDRCONFIG

Some people run wg(8) using hard coded v6 addresses before interfaces
have v6 addresses, causing getaddrinfo to fail. Since AI_ADDRCONFIG
doesn't actualy change the sorting, but just the queries made, we don't
really need AI_ADDRCONFIG anyway, since we're always only taking the
first result.

Reported-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: allowed-ips is easier to parse with spaces instead of ", "
Jason A. Donenfeld [Tue, 20 Dec 2016 18:14:19 +0000 (19:14 +0100)] 
wg: allowed-ips is easier to parse with spaces instead of ", "

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg-config: cleanup ip parsing
Jason A. Donenfeld [Tue, 20 Dec 2016 03:08:41 +0000 (04:08 +0100)] 
wg-config: cleanup ip parsing

This also sorts routes by cidr.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: fix latest-handshake typo in documentation
Jason A. Donenfeld [Wed, 14 Dec 2016 21:18:29 +0000 (22:18 +0100)] 
wg: fix latest-handshake typo in documentation

Reported-by: Dan Lüdtke <mail@danrl.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agocontrib: add wg-config
Jason A. Donenfeld [Thu, 8 Dec 2016 15:13:25 +0000 (16:13 +0100)] 
contrib: add wg-config

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: warn about clock going backward
Jason A. Donenfeld [Tue, 29 Nov 2016 12:38:59 +0000 (13:38 +0100)] 
wg: warn about clock going backward

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoheaders: cleanup notices
Jason A. Donenfeld [Fri, 18 Nov 2016 05:22:00 +0000 (06:22 +0100)] 
headers: cleanup notices

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: chill modern gcc out
Jason A. Donenfeld [Sat, 5 Nov 2016 20:35:33 +0000 (21:35 +0100)] 
wg: chill modern gcc out

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoqemu: move build outside of kernel dir to avoid kernel's make clean
Jason A. Donenfeld [Sat, 5 Nov 2016 12:22:55 +0000 (13:22 +0100)] 
qemu: move build outside of kernel dir to avoid kernel's make clean

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: abstract pkg-config to PKG_CONFIG
Jason A. Donenfeld [Wed, 2 Nov 2016 10:50:52 +0000 (11:50 +0100)] 
wg: abstract pkg-config to PKG_CONFIG

Distros like Exherbo have multitarget setups with toolnames prefixed by
the arch.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: everybody hates automatic stripping
Jason A. Donenfeld [Wed, 2 Nov 2016 10:49:07 +0000 (11:49 +0100)] 
wg: everybody hates automatic stripping

I happen to like it, but package managers don't. The GNU standard [1]
says there should be a separate install-strip target. I don't like
duplicating code like that. So, instead, I'll just remove stripping all
together.

[1] https://www.gnu.org/prep/standards/html_node/Standard-Targets.html

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agogit: organize ignore files
Jason A. Donenfeld [Thu, 29 Sep 2016 17:31:22 +0000 (19:31 +0200)] 
git: organize ignore files

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoRework headers and includes
Jason A. Donenfeld [Thu, 29 Sep 2016 02:36:14 +0000 (04:36 +0200)] 
Rework headers and includes

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agowg: allow multiple AllowedIPs invocations
Jason A. Donenfeld [Tue, 30 Aug 2016 02:35:51 +0000 (04:35 +0200)] 
wg: allow multiple AllowedIPs invocations

It turns out this is a somewhat natural thing to do in config files.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoexamples: add key extractor
Jason A. Donenfeld [Wed, 24 Aug 2016 15:44:41 +0000 (17:44 +0200)] 
examples: add key extractor

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
8 years agoexamples: add nat-hole-punching
Jason A. Donenfeld [Tue, 23 Aug 2016 01:56:42 +0000 (03:56 +0200)] 
examples: add nat-hole-punching

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agotests: use makefile and expand greatly
Jason A. Donenfeld [Mon, 25 Jul 2016 12:17:11 +0000 (14:17 +0200)] 
tests: use makefile and expand greatly

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agopersistent-keepalive: change range to [1,65535]
Jason A. Donenfeld [Mon, 8 Aug 2016 11:53:00 +0000 (13:53 +0200)] 
persistent-keepalive: change range to [1,65535]

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: use correct headers in ipc
Jason A. Donenfeld [Mon, 1 Aug 2016 19:31:07 +0000 (21:31 +0200)] 
wg: use correct headers in ipc

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: do not show private keys in pretty output
Jason A. Donenfeld [Thu, 28 Jul 2016 15:18:17 +0000 (17:18 +0200)] 
wg: do not show private keys in pretty output

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agoc: specify static array size in function params
Jason A. Donenfeld [Wed, 27 Jul 2016 09:30:05 +0000 (11:30 +0200)] 
c: specify static array size in function params

The C standard states:

  A declaration of a parameter as ``array of type'' shall be adjusted to ``qualified pointer to
  type'', where the type qualifiers (if any) are those specified within the [ and ] of the
  array type derivation. If the keyword static also appears within the [ and ] of the
  array type derivation, then for each call to the function, the value of the corresponding
  actual argument shall provide access to the first element of an array with at least as many
  elements as specified by the size expression.

By changing void func(int array[4]) to void func(int array[static 4]),
we automatically get the compiler checking argument sizes for us, which
is quite nice.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: use stream instead of seqpacket
Jason A. Donenfeld [Fri, 22 Jul 2016 19:07:12 +0000 (21:07 +0200)] 
wg: use stream instead of seqpacket

To support OS X and Windows, we have to. Ugh.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: Use seqpacket instead of dgram
Jason A. Donenfeld [Fri, 22 Jul 2016 18:30:34 +0000 (20:30 +0200)] 
wg: Use seqpacket instead of dgram

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: add -MP to makefile
Jason A. Donenfeld [Fri, 22 Jul 2016 12:58:30 +0000 (14:58 +0200)] 
wg: add -MP to makefile

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: add default cflag
Jason A. Donenfeld [Thu, 21 Jul 2016 14:38:56 +0000 (16:38 +0200)] 
wg: add default cflag

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: propagate set errno
Jason A. Donenfeld [Thu, 21 Jul 2016 11:33:20 +0000 (13:33 +0200)] 
wg: propagate set errno

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: abstract sockets are dangerous
Jason A. Donenfeld [Thu, 21 Jul 2016 10:27:54 +0000 (12:27 +0200)] 
wg: abstract sockets are dangerous

They have no permissions, so we're probably better off just creating a
socket file with the umask set, as we do in BSD.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: rename kernel to ipc
Jason A. Donenfeld [Wed, 20 Jul 2016 19:24:27 +0000 (21:24 +0200)] 
wg: rename kernel to ipc

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: support horrible freebsd/osx/unix semantics
Jason A. Donenfeld [Wed, 20 Jul 2016 18:52:11 +0000 (20:52 +0200)] 
wg: support horrible freebsd/osx/unix semantics

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: first additions of userspace integration
Jason A. Donenfeld [Tue, 19 Jul 2016 13:26:56 +0000 (15:26 +0200)] 
wg: first additions of userspace integration

This is designed to work with a server that follows this:

  struct sockaddr_un addr = {
      .sun_family = AF_UNIX,
      .sun_path = "/var/run/wireguard/wguserspace0.sock"
  };
  int fd, ret;
  ssize_t len;
  socklen_t socklen;
  struct wgdevice *device;

  fd = socket(AF_UNIX, SOCK_DGRAM, 0);
  if (fd < 0)
      exit(1);
  if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
      exit(1);

  for (;;) {
      /* First we look at how big the next message is, so we know how much to
       * allocate. Note on BSD you can instead use ioctl(fd, FIONREAD, &len). */
      len = recv(fd, NULL, 0, MSG_PEEK | MSG_TRUNC);
      if (len < 0) {
          handle_error();
          continue;
      }
      /* Next we allocate a buffer for the received data. */
      device = NULL;
      if (len) {
          device = malloc(len);
          if (!device) {
              handle_error();
              continue;
          }
      }
      /* Finally we receive the data, storing too the return address. */
      socklen = sizeof(addr);
      len = recvfrom(fd, device, len, 0, (struct sockaddr *)&addr, (socklen_t *)&socklen);
      if (len < 0) {
          handle_error();
          free(device);
          continue;
      }
      if (!len) { /* If len is zero, it's a "get" request, so we send our device back. */
          device = get_current_wireguard_device(&len);
          sendto(fd, device, len, 0, (struct sockaddr *)&addr, socklen);
      } else { /* Otherwise, we just received a wgdevice, so we should "set" and send back the return status. */
          ret = set_current_wireguard_device(device);
          sendto(fd, &ret, sizeof(ret), 0, (struct sockaddr *)&addr, socklen);
          free(device);
      }
  }

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agowg: fix numbering in man page
Jason A. Donenfeld [Mon, 11 Jul 2016 10:49:47 +0000 (12:49 +0200)] 
wg: fix numbering in man page

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agopersistent keepalive: use authenticated keepalives
Jason A. Donenfeld [Fri, 8 Jul 2016 18:34:32 +0000 (20:34 +0200)] 
persistent keepalive: use authenticated keepalives

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agoexamples: update ncat-client-server readme
Jason A. Donenfeld [Fri, 8 Jul 2016 21:41:45 +0000 (23:41 +0200)] 
examples: update ncat-client-server readme

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agopersistent keepalive: enable in an example
Jason A. Donenfeld [Fri, 8 Jul 2016 10:36:04 +0000 (12:36 +0200)] 
persistent keepalive: enable in an example

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agopersistent keepalive: documentation
Jason A. Donenfeld [Fri, 8 Jul 2016 00:52:41 +0000 (02:52 +0200)] 
persistent keepalive: documentation

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agopersistent keepalive: add userspace support
Jason A. Donenfeld [Fri, 8 Jul 2016 00:30:03 +0000 (02:30 +0200)] 
persistent keepalive: add userspace support

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agogo test: don't rely on undefined append behavior
Jonathan Rudenberg [Thu, 7 Jul 2016 11:58:30 +0000 (07:58 -0400)] 
go test: don't rely on undefined append behavior

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agorust test: actually use tai64n
Jason A. Donenfeld [Thu, 7 Jul 2016 11:48:04 +0000 (13:48 +0200)] 
rust test: actually use tai64n

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agogo test: actually use TAI64N
Jason A. Donenfeld [Thu, 7 Jul 2016 11:47:32 +0000 (13:47 +0200)] 
go test: actually use TAI64N

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
9 years agogo test: don't use 1 as icmp ids
Jason A. Donenfeld [Thu, 7 Jul 2016 11:44:01 +0000 (13:44 +0200)] 
go test: don't use 1 as icmp ids

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