aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/allowedips.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* global: various formatting tweeksJason A. Donenfeld2018-11-131-7/+4
|
* allowedips: fix up macros and annotationsJason A. Donenfeld2018-10-251-63/+70
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: give if statements brackets and other cleanupsJason A. Donenfeld2018-10-091-8/+11
|
* allowedips: swap endianness early onArnd Bergmann2018-10-081-6/+9
| | | | | | | | Otherwise if gcc's optimizer is able to look far in but not overly far in, we wind up with "warning: 'key' may be used uninitialized in this function [-Wmaybe-uninitialized]". Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* global: rename struct wireguard_ to struct wg_Jason A. Donenfeld2018-10-081-16/+18
| | | | | | This required a bit of pruning of our christmas trees. Suggested-by: Jiri Pirko <jiri@resnulli.us>
* global: rename include'd C files to be .cJason A. Donenfeld2018-10-061-1/+1
| | | | | | | | | This is done by 259 other files in the kernel tree: linux $ rg '#include.*\.c' -l | wc -l 259 Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: change BUG_ON to WARN_ONJason A. Donenfeld2018-10-021-2/+2
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: prefix all functions with wg_Jason A. Donenfeld2018-10-021-20/+21
| | | | | | | | | | | | | I understand why this must be done, though I'm not so happy about having to do it. In some places, it puts us over 80 chars and we have to break lines up in further ugly ways. And in general, I think this makes things harder to read. Yet another thing we must do to please upstream. Maybe this can be replaced in the future by some kind of automatic module namespacing logic in the linker, or even combined with LTO and aggressive symbol stripping. Suggested-by: Andrew Lunn <andrew@lunn.ch>
* 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.
* allowedips: change from BUG_ON to WARN_ONJason A. Donenfeld2018-09-201-2/+2
| | | | | | | | This is never going to hit anyway, and if it does, it's a development problem that will be caught with the selftests anyway. So don't make Andrew Lunn upset, and just change it to a WARN_ON. Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: remove non-essential inline annotationsJason A. Donenfeld2018-09-161-1/+1
|
* global: always find OOM unlikelyJason A. Donenfeld2018-09-041-3/+3
| | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: satisfy check_patch.pl errorsJason A. Donenfeld2018-09-031-2/+2
|
* global: run through clang-formatJason A. Donenfeld2018-08-281-49/+99
| | | | | | | This is the worst commit in the whole repo, making the code much less readable, but so it goes with upstream maintainers. We are now woefully wrapped at 80 columns.
* allowedips: use different macro names so as to avoid confusionJason A. Donenfeld2018-08-031-5/+5
| | | | | | | A mailing list interlocutor argues that sharing the same macro name might lead to errors down the road. Suggested-by: Andrew Lunn <andrew@lunn.ch>
* allowedips: free root inside of RCU callbackJason A. Donenfeld2018-08-011-8/+10
| | | | | | This reduces the amount of call_rcu invocations considerably. Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
* allowedips: avoid window of disappeared peerJann Horn2018-08-011-1/+5
| | | | | | | If a peer is removed, it's possible for a lookup to momentarily return NULL, resulting in needless -ENOKEY returns. Signed-off-by: Jann Horn <jannh@google.com>
* allowedips: prevent double read in krefJason A. Donenfeld2018-08-011-11/+11
| | | | | | | | | | | | | | | | | Blocks like: if (node_placement(*trie, key, cidr, bits, &node, lock)) { node->peer = peer; return 0; } May result in a double read when adjusting the refcount, in the highly unlikely case of LTO and an overly smart compiler. While we're at it, replace rcu_assign_pointer(X, NULL); with RCU_INIT_POINTER. Reported-by: Jann Horn <jann@thejh.net>
* peer: simplify rcu reference countsJason A. Donenfeld2018-07-311-1/+1
| | | | | | | Use RCU reference counts only when we must, and otherwise use a more reasonably named function. Reported-by: Jann Horn <jann@thejh.net>
* allowedips: set pointer to null before freeingJason A. Donenfeld2018-05-221-2/+3
|
* allowedips: simplify arithmeticJason A. Donenfeld2018-05-101-1/+1
| | | | Suggested-by: Samuel Neves <sneves@dei.uc.pt>
* allowedips: produce better assembly with unsigned arithmeticJason A. Donenfeld2018-05-101-9/+9
| | | | Suggested-by: Samuel Neves <sneves@dei.uc.pt>
* allowedips: use native endian on lookupJason A. Donenfeld2018-05-101-21/+40
|
* allowedips: fix comment styleJason A. Donenfeld2018-02-211-1/+2
|
* allowedips: indicate to clang-analyzer that trie is non-nullJason A. Donenfeld2018-02-141-0/+1
| | | | | We check it in the block just above the only call to node_placement, so we're certain this is the case.
* global: year bumpJason A. Donenfeld2018-01-031-1/+1
|
* 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>
* allowedips: simplifyJason A. Donenfeld2017-11-251-35/+12
|
* allowedips: optimizeJason A. Donenfeld2017-11-251-14/+52
|
* allowedips: do not write out of boundsJason A. Donenfeld2017-11-131-2/+4
|
* allowedips: rename from routingtableJason A. Donenfeld2017-11-101-0/+306
Makes it more clear that this _not_ a routing table replacement.