aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/peer.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* send: consider dropped stage packets to be droppedJason A. Donenfeld2018-10-271-1/+1
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* peer: another peer_remove cleanupJason A. Donenfeld2018-10-251-8/+30
|
* global: more nitsJason A. Donenfeld2018-10-081-1/+3
|
* global: rename struct wireguard_ to struct wg_Jason A. Donenfeld2018-10-081-14/+11
| | | | | | This required a bit of pruning of our christmas trees. Suggested-by: Jiri Pirko <jiri@resnulli.us>
* global: prefix all functions with wg_Jason A. Donenfeld2018-10-021-30/+33
| | | | | | | | | | | | | 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.
* global: always find OOM unlikelyJason A. Donenfeld2018-09-041-1/+1
| | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: prefer sizeof(*pointer) when possibleJason A. Donenfeld2018-09-041-1/+1
| | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: run through clang-formatJason A. Donenfeld2018-08-281-28/+57
| | | | | | | 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.
* send: switch handshake stamp to an atomicJason A. Donenfeld2018-08-041-1/+1
| | | | | | | | | | | Rather than abusing the handshake lock, we're much better off just using a boring atomic64 for this. It's simpler and performs better. Also, while we're at it, we set the handshake stamp both before and after the calculations, in case the calculations block for a really long time waiting for the RNG to initialize. Otherwise it's possible that when the RNG finally initializes, two handshakes are sent back to back, which isn't sensible.
* peer: ensure destruction doesn't raceJason A. Donenfeld2018-08-031-10/+33
| | | | | Completely rework peer removal to ensure peers don't jump between contexts and create races.
* peer: ensure resources are freed when creation failsJason A. Donenfeld2018-08-011-13/+19
| | | | And in general tighten up the logic of peer creation.
* peer: simplify rcu reference countsJason A. Donenfeld2018-07-311-9/+1
| | | | | | | Use RCU reference counts only when we must, and otherwise use a more reasonably named function. Reported-by: Jann Horn <jann@thejh.net>
* recieve: disable NAPI busy pollingThomas Gschwantner2018-07-181-0/+1
| | | | | | | | | | | | | | This avoids adding one reference per peer to the napi_hash hashtable, as normally done by netif_napi_add(). Since we potentially could have up to 2^20 peers this would make busy polling very slow globally. This approach is preferable to having only a single napi struct because we get one gro_list per peer, which means packets can be combined nicely even if we have a large number of peers. This is also done by gro_cells_init() in net/core/gro_cells.c . Signed-off-by: Thomas Gschwantner <tharre3@gmail.com>
* receive: use NAPI on the receive pathJonathan Neuschäfer2018-07-081-3/+7
| | | | | | Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com> [Jason: fixed up the flushing of the rx_queue in peer_remove] Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
* global: use fast boottime instead of normal boottimeJason A. Donenfeld2018-06-231-1/+1
| | | | Generally if we're inaccurate by a few nanoseconds, it doesn't matter.
* global: use ktime boottime instead of jiffiesJason A. Donenfeld2018-06-231-1/+1
| | | | | | | | Since this is a network protocol, expirations need to be accounted for, even across system suspend. On real systems, this isn't a problem, since we're clearing all keys before suspend. But on Android, where we don't do that, this is something of a problem. So, we switch to using boottime instead of jiffies.
* 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>
* device: clear last handshake timer on ifdownJason A. Donenfeld2017-11-291-0/+1
| | | | | | | Otherwise new handshakes might not occur immediately when the interface goes up and down. Also initialize peers to having a proper zeroed handshake jiffies.
* allowedips: rename from routingtableJason A. Donenfeld2017-11-101-1/+1
| | | | Makes it more clear that this _not_ a routing table replacement.
* global: revert checkpatch.pl changesJason A. Donenfeld2017-11-021-1/+1
| | | | | These changes were suggested by checkpatch.pl, but actually cause big problems depending on the options. Revert.
* global: style nitsJason A. Donenfeld2017-10-311-1/+2
|
* 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.
* peer: store total number of peers instead of iteratingJason A. Donenfeld2017-10-311-12/+3
| | | | | | This is faster, since it means adding a new peer is O(1) instead of O(n). It's also safe to do because we're holding the device_update_lock on both the ++ and the --.
* global: accept decent check_patch.pl suggestionsJason A. Donenfeld2017-10-311-3/+4
|
* routingtable: only use device's mutex, not a special rt oneJason A. Donenfeld2017-10-091-1/+1
|
* queueing: use ptr_ring instead of linked listsJason A. Donenfeld2017-10-051-2/+4
|
* global: add space around variable declarationsJason A. Donenfeld2017-10-031-0/+4
|
* noise: use spinlock for rotating keysJason A. Donenfeld2017-10-021-1/+1
| | | | | This should only really be contended in extremely exceptional cases, so changing from a mutex to a spinlock is likely fine.
* peer: remove from RCU lists when the kref is zeroJason A. Donenfeld2017-10-021-4/+5
|
* peer: ensure that lookup tables are added lastJason A. Donenfeld2017-10-021-3/+3
|
* netlink: switch from ioctl to netlink for configurationJason A. Donenfeld2017-10-021-1/+1
|
* timers: convert to use netif_runningJason A. Donenfeld2017-09-241-2/+3
|
* queue: entirely rework parallel systemJason A. Donenfeld2017-09-181-10/+11
| | | | | | | | | | This removes our dependency on padata and moves to a different mode of multiprocessing that is more efficient. This began as Samuel Holland's GSoC project and was gradually reworked/redesigned/rebased into this present commit, which is a combination of his initial contribution and my subsequent rewriting and redesigning.
* global: use pointer to net_deviceJason A. Donenfeld2017-07-201-2/+2
| | | | | | DaveM prefers it to be this way per [1]. [1] http://www.spinics.net/lists/netdev/msg443992.html
* peer: explicitly initialize atomicJason A. Donenfeld2017-06-051-0/+3
|
* debug: print interface name in dmesgJason A. Donenfeld2017-05-311-2/+2
|
* style: spaces after for loopsJason A. Donenfeld2017-05-301-2/+2
|
* peer: use iterator macro instead of callbackJason A. Donenfeld2017-05-301-27/+0
|
* noise: precompute static-static ECDH operationJason A. Donenfeld2017-05-301-1/+4
|
* handshake: process in parallelJason A. Donenfeld2017-05-301-2/+2
|
* noise: redesign preshared key modeJason A. Donenfeld2017-05-171-3/+3
|
* data: cleanup parallel workqueue and use two max_activeJason A. Donenfeld2017-04-081-2/+2
|
* locking: always use _bhJason A. Donenfeld2017-04-041-4/+4
| | | | | All locks are potentially between user context and softirq, which means we need to take the _bh variant.
* Update copyrightJason A. Donenfeld2017-01-101-1/+1
|
* cookies: use xchacha20poly1305 instead of chacha20poly1305Jason A. Donenfeld2016-12-231-0/+1
| | | | | This allows us to precompute the blake2s calls and save cycles, since hchacha is fast.
* peer: don't use sockaddr_storage to reduce memory usageJason A. Donenfeld2016-12-131-1/+1
|
* headers: cleanup noticesJason A. Donenfeld2016-11-211-1/+1
|
* socket: keep track of src address in sending packetsJason A. Donenfeld2016-11-151-1/+1
|