aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/ipc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: dual license core files as MIT for FreeBSDJason A. Donenfeld2022-06-101-1/+1
| | | | | | | To make it easier for FreeBSD to import wg(8), dual license the core files as MIT, so that they don't have any trouble. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: add wireguard-nt supportJason A. Donenfeld2021-07-201-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: freebsd: add initial FreeBSD supportJason A. Donenfeld2021-03-111-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wireguard-tools: drag in headers for prototypesKyle Evans2021-03-101-0/+1
| | | | | | | ipc.c and terminal.c provide definitions for prototypes in their respective headers, drag those in. Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* ipc: split into separate files per-platformJason A. Donenfeld2020-05-251-1152/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: openbsd: switch to array ioctl interfaceJason A. Donenfeld2020-05-131-41/+41
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: cleanup openbsd supportJason A. Donenfeld2020-05-101-93/+100
| | | | | | We also add a wg_if.h in the fallback include path. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: add support for openbsd kernel implementationMatt Dunwoodie2020-05-101-3/+262
| | | | Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
* ipc: remove extra spaceJason A. Donenfeld2020-05-101-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: don't pretend that sysconf isn't a functionJason A. Donenfeld2020-02-051-1/+1
| | | | | | We can cache the value of this instead of evaluating every time. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: remove libmnl requirementJason A. Donenfeld2020-02-031-4/+1
| | | | | | | | It turns out that the binary actually gets smaller if we simply inline the very small parts of libmnl that we need. Since we wind up needing the mnlg bits anyway, there's little benefit in linking to libmnl. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: make sure to clear return value when trying againJason A. Donenfeld2020-01-111-1/+2
| | | | | | | Otherwise this runs in an infinite loop if at some point a dump was interrupted. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ipc: simplify inflatable buffer and add fuzzerJason A. Donenfeld2020-01-041-60/+42
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyrightJason A. Donenfeld2020-01-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: add back source formerly shared with kernel moduleJason A. Donenfeld2019-12-261-1/+1
| | | | | | | | | | 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>
* ipc: make sure userspace communication frees wgdeviceJason A. Donenfeld2019-12-051-10/+13
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: windows: enforce named pipe ownership and use protected prefixJason A. Donenfeld2019-08-311-16/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: add wincompat layer to wg(8)Jason A. Donenfeld2019-05-311-0/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: use __kernel_timespec for handshake timeJason A. Donenfeld2019-01-231-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: update copyrightJason A. Donenfeld2019-01-071-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: don't fail if a netlink interface dump is inconsistentJason A. Donenfeld2018-10-131-2/+9
| | | | | | | | | | | 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>
* netlink: do not stuff index into nla typeJason A. Donenfeld2018-10-081-5/+4
| | | | | | | | 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>
* global: put SPDX identifier on its own lineJason A. Donenfeld2018-09-201-2/+2
| | | | | | | 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>
* global: prefer sizeof(*pointer) when possibleJason A. Donenfeld2018-09-041-6/+6
| | | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: ipc: do not warn on unrecognized netlink attributesJason A. Donenfeld2018-09-021-17/+0
| | | | | | It makes extending things more difficult. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fix OpenBSD buildFilippo Valsorda2018-05-221-1/+1
| | | | | | License: MIT Signed-off-by: Filippo Valsorda <valsorda@google.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fix errno propagation and messagesJason A. Donenfeld2018-05-181-2/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fixup errno handlingJason A. Donenfeld2018-02-171-7/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: normalize strncpy/snprintf usageJason A. Donenfeld2018-02-141-3/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: year bumpJason A. Donenfeld2018-01-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: add SPDX tags to all filesGreg Kroah-Hartman2017-12-091-1/+4
| | | | | | | | | | | | | | 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>
* global: switch from timeval to timespecJason A. Donenfeld2017-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | 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>
* wg: tighten up strtoul parsingJason A. Donenfeld2017-11-171-8/+8
| | | | | Reported-by: Cedric Buxin <cedric.buxin@izri.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: allow for NULL keys everywhereJason A. Donenfeld2017-11-111-7/+18
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: style nitsJason A. Donenfeld2017-10-311-0/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: infuriating kernel iterator styleJason A. Donenfeld2017-10-311-2/+2
| | | | | | | | | | | | | | | | | | | 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>
* wg: account for padding being in zero attributeJason A. Donenfeld2017-10-171-0/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: newline after warningJason A. Donenfeld2017-10-171-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: styleJason A. Donenfeld2017-10-171-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: store tail pointer to make coalescing peers fastJason A. Donenfeld2017-10-101-72/+68
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: warn once on unrecognized itemsJason A. Donenfeld2017-10-091-0/+21
| | | | | | | | | | 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>
* wg: try again if dump is interruptedJason A. Donenfeld2017-10-081-1/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: compile on non-LinuxJason A. Donenfeld2017-10-021-16/+22
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: simmer down silly compilersJason A. Donenfeld2017-10-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: do not warn on unrecognized itemsJason A. Donenfeld2017-10-021-25/+0
| | | | | | Upstream advice is to simply be silent. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: switch from ioctl to netlink for configurationJason A. Donenfeld2017-10-021-154/+447
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: uapi: only make sure socket file is socketJason A. Donenfeld2017-09-261-4/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: use key_is_zero for comparing to zerosJason A. Donenfeld2017-09-241-3/+2
| | | | | | | | | 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>
* wg: stricter userspace ipc parsingJason A. Donenfeld2017-08-021-3/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: remove double include in ipcJason A. Donenfeld2017-06-291-1/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>