aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/show.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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-2/+2
| | | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: only error on wg show if all interfaces failJason A. Donenfeld2018-07-081-1/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fix OpenBSD buildFilippo Valsorda2018-05-221-0/+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-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: normalize strncpy/snprintf usageJason A. Donenfeld2018-02-141-13/+15
| | | | 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-4/+4
| | | | | | | | | | | | | | | | | | | | | 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: allow for NULL keys everywhereJason A. Donenfeld2017-11-111-11/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: style nitsJason A. Donenfeld2017-10-311-2/+13
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: infuriating kernel iterator styleJason A. Donenfeld2017-10-311-14/+14
| | | | | | | | | | | | | | | | | | | 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: retry resolution except when fatalJason A. Donenfeld2017-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | The reference to this is <https://sourceware.org/glibc/wiki/NameResolver>, which mentions: "From the perspective of the application that calls getaddrinfo() it perhaps doesn't matter that much since EAI_FAIL, EAI_NONAME and EAI_NODATA are all permanent failure codes and the causes are all permanent failures in the sense that there is no point in retrying later." This should cover more early-boot situations. While we're at it, we clean up the logic a bit so that we don't have a retry message on the final non-retrying attempt. We also peer into errno when receiving EAI_SYSTEM, to report to the user what actually happened. Also, fix the quoting back tick front tick mess. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: switch from ioctl to netlink for configurationJason A. Donenfeld2017-10-021-85/+63
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: use key_is_zero for comparing to zerosJason A. Donenfeld2017-09-241-6/+4
| | | | | | | | | 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: support text-based ipcJason A. Donenfeld2017-05-171-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* noise: redesign preshared key modeJason A. Donenfeld2017-05-171-8/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: no hyphen in preshared, to keep uniformityJason A. Donenfeld2017-04-201-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: side channel resistant base64Jason A. Donenfeld2017-04-191-7/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: add wg show [interface] dumpJason A. Donenfeld2017-02-231-2/+42
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: give "off" value for fwmarkJason A. Donenfeld2017-02-231-1/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* socket: enable setting of fwmarkJason A. Donenfeld2017-02-131-1/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Update copyrightJason A. Donenfeld2017-01-101-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* uapi: use sockaddr union instead of sockaddr_storageJason A. Donenfeld2017-01-101-9/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: rename 'bandwidth' to 'transfer' in outputTomasz Torcz2016-12-231-3/+3
| | | | | | | '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>
* wg: allowed-ips is easier to parse with spaces instead of ", "Jason A. Donenfeld2016-12-231-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fix latest-handshake typo in documentationJason A. Donenfeld2016-12-161-1/+1
| | | | | Reported-by: Dan Lüdtke <mail@danrl.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: warn about clock going backwardJason A. Donenfeld2016-11-291-16/+20
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* headers: cleanup noticesJason A. Donenfeld2016-11-211-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: do not show private keys in pretty outputJason A. Donenfeld2016-08-021-2/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* c: specify static array size in function paramsJason A. Donenfeld2016-08-021-1/+1
| | | | | | | | | | | | | | | | | 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>
* wg: rename kernel to ipcJason A. Donenfeld2016-07-211-6/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: first additions of userspace integrationJason A. Donenfeld2016-07-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* persistent keepalive: add userspace supportJason A. Donenfeld2016-07-081-10/+36
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Initial commitJason A. Donenfeld2016-06-251-0/+366
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>