aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/config.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: bump copyrightJason A. Donenfeld2020-01-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: allow setting WG_ENDPOINT_RESOLUTION_RETRIESJason A. Donenfeld2019-05-291-4/+22
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: warn if an AllowedIP has a nonzero host partLuis Ressel2019-03-231-0/+34
| | | | | Signed-off-by: Luis Ressel <aranea@aixah.de> 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>
* 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-5/+5
| | | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fix misspelling of strchrnul in commentJonathan Neuschäfer2018-06-221-1/+1
| | | | | Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: FreeBSD doesn't have EAI_NODATAJason A. Donenfeld2018-02-171-2/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: allow in-line commentsJason A. Donenfeld2018-02-171-6/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: fread doesn't change errnoJason A. Donenfeld2018-01-301-4/+0
| | | | | | | 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>
* wg: plug memleak in config error pathJason A. Donenfeld2018-01-181-0/+1
| | | | 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>
* wg: fix removing preshared keysJason A. Donenfeld2017-11-231-69/+55
| | | | | | Also clean up related logic quite a bit and add unit tests. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: tighten up strtoul parsingJason A. Donenfeld2017-11-171-28/+54
| | | | | 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-5/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: style nitsJason A. Donenfeld2017-10-311-0/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: infuriating kernel iterator styleJason A. Donenfeld2017-10-311-1/+1
| | | | | | | | | | | | | | | | | | | 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: don't insist on having a private keyJason A. Donenfeld2017-10-171-5/+0
| | | | | | | | | | | This lets us do flexible things from wg-quick such as: PostUp = wg set %i private-key <(pass WireGuard/private-keys/%i) It also was never a very sensible policy to enforce. Suggested-by: Luis Ressel <aranea@aixah.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: retry resolution except when fatalJason A. Donenfeld2017-10-171-18/+20
| | | | | | | | | | | | | | | | | | | | | 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>
* Makefile: clang now builds the kernel, so use scan-buildJason A. Donenfeld2017-10-051-1/+1
| | | | | | | Also add little stub for coccinelle and clean up semicolon issue it found. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netlink: switch from ioctl to netlink for configurationJason A. Donenfeld2017-10-021-143/+132
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: use key_is_zero for comparing to zerosJason A. Donenfeld2017-09-241-8/+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: fix removal of pskJason A. Donenfeld2017-08-231-1/+1
| | | | | | This is an attribute of the peer, not the device. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: allow creating device with no peersJason A. Donenfeld2017-05-311-4/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: support text-based ipcJason A. Donenfeld2017-05-171-7/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: stricter key file readingJason A. Donenfeld2017-05-171-31/+40
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* noise: redesign preshared key modeJason A. Donenfeld2017-05-171-22/+21
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: retry name resolution on temporary failureJason A. Donenfeld2017-05-171-1/+10
| | | | | | This should solve many problems at init time. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: check for malloc failureJason A. Donenfeld2017-04-191-0/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: side channel resistant base64Jason A. Donenfeld2017-04-191-3/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: do not use addrconfig with port in gaiJason A. Donenfeld2017-03-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* uapi: add version magicJason A. Donenfeld2017-03-241-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: give "off" value for fwmarkJason A. Donenfeld2017-02-231-0/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* socket: enable setting of fwmarkJason A. Donenfeld2017-02-131-0/+28
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: remove key for any empty fileJason A. Donenfeld2017-02-071-11/+3
| | | | | | | 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>
* wg: setconf should remove existing pskJason A. Donenfeld2017-02-071-0/+3
| | | | 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-3/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* uapi: use flag instead of C bitfield for portabilityJason A. Donenfeld2017-01-101-8/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: do not use AI_ADDRCONFIGJason A. Donenfeld2016-12-231-2/+1
| | | | | | | | | | | 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>
* headers: cleanup noticesJason A. Donenfeld2016-11-211-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: chill modern gcc outJason A. Donenfeld2016-11-051-22/+12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: allow multiple AllowedIPs invocationsJason A. Donenfeld2016-08-301-1/+0
| | | | | | It turns out this is a somewhat natural thing to do in config files. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* persistent-keepalive: change range to [1,65535]Jason A. Donenfeld2016-08-081-2/+2
| | | | 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-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* persistent keepalive: add userspace supportJason A. Donenfeld2016-07-081-0/+30
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg: improve error reporting and detectionJason A. Donenfeld2016-07-031-6/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Initial commitJason A. Donenfeld2016-06-251-0/+518
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>