aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/timers.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* netlink: use __kernel_timespec for handshake timeJason A. Donenfeld2019-01-231-1/+1
|
* global: update copyrightJason A. Donenfeld2019-01-071-1/+1
|
* timers: it is always reasonable to remove a timerJason A. Donenfeld2018-10-271-14/+4
| | | | | | | | | | | | | | If struct timer_list has not been setup, it is zeroed, in which case timer_pending is false, so calling del_timer is safe. Calling del_timer is also safe on a timer that has already been del_timer'd. And calling del_timer is safe after a peer is dead, since the whole point of it being dead is that no more timers are created and all contexts eventually stop. Finally del_timer uses a lock, which means it's safe to call it concurrently. Therefore, we do not need any guards around calls to del_timer. While we're at it, we can get rid of the old lingering timers_enabled boolean which wasn't doing anything anyway anymore.
* timers: do not use wg_peer_get_maybe_zeroJason A. Donenfeld2018-10-271-35/+13
| | | | | | | | | peer_remove calls sets is_dead to true and calls timers_stop before putting the last reference, which means whenever timers do actually trigger, they should only trigger with a reference, and therefore we don't need the maybe_zero dance. This also narrows the scope of using maybe_zero to just be lookup structures (the two hashtables and allowedips), which is what the idiom is actually meant for.
* send: consider dropped stage packets to be droppedJason A. Donenfeld2018-10-271-1/+1
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: do not allow compiler to reorder is_valid or is_deadJason A. Donenfeld2018-10-251-3/+5
| | | | Suggested-by: Jann Horn <jann@thejh.net>
* timers: avoid using control statements in macroJason A. Donenfeld2018-10-081-8/+23
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: more nitsJason A. Donenfeld2018-10-081-0/+1
|
* global: rename struct wireguard_ to struct wg_Jason A. Donenfeld2018-10-081-15/+15
| | | | | | This required a bit of pruning of our christmas trees. Suggested-by: Jiri Pirko <jiri@resnulli.us>
* global: prefix functions used in callbacks with wg_Jason A. Donenfeld2018-10-081-16/+15
| | | | Suggested-by: Jiri Pirko <jiri@resnulli.us>
* global: prefix all functions with wg_Jason A. Donenfeld2018-10-021-25/+25
| | | | | | | | | | | | | 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: satisfy check_patch.pl errorsJason A. Donenfeld2018-09-031-1/+1
|
* global: run through clang-formatJason A. Donenfeld2018-08-281-36/+86
| | | | | | | 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.
* timers: include header in right fileJason A. Donenfeld2018-08-091-2/+0
|
* peer: ensure destruction doesn't raceJason A. Donenfeld2018-08-031-26/+34
| | | | | Completely rework peer removal to ensure peers don't jump between contexts and create races.
* peer: simplify rcu reference countsJason A. Donenfeld2018-07-311-1/+4
| | | | | | | Use RCU reference counts only when we must, and otherwise use a more reasonably named function. Reported-by: Jann Horn <jann@thejh.net>
* ratelimiter: prevent init/uninit raceJason A. Donenfeld2018-07-311-0/+2
| | | | | | | Fixes a classic ABA problem that isn't actually reachable because of rtnl_lock, but it's good to be correct anyway. Reported-by: Jann Horn <jann@thejh.net>
* global: use ktime boottime instead of jiffiesJason A. Donenfeld2018-06-231-10/+10
| | | | | | | | 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.
* timers: no need to clear keepalive in persistent keepaliveJason A. Donenfeld2018-05-191-4/+1
| | | | | | | | We do this after sending the keepalive anyway. This is something of a regression, though, since before we'd cancel and then send, but now we send and then cancel, so it introduces a potential race, but hopefully that isn't too big of a deal.
* timers: clear send_keepalive timer on sending handshake responseJason A. Donenfeld2018-05-191-6/+8
| | | | | | We reorganize this into also doing so on sending keepalives itself, which means the state machine is much more consistent, even if this was already implied.
* timers: fix up commentJason A. Donenfeld2018-05-191-2/+2
|
* timers: remove slack_timeJason A. Donenfeld2018-05-191-8/+2
| | | | | It's already done implicitly by recent kernels and it's not adding much here.
* timers: reinitialize state on initJason A. Donenfeld2018-05-181-0/+3
|
* timers: round up instead of down in slack_timeJason A. Donenfeld2018-05-181-2/+2
| | | | | | | | | On systems with a 100hz tick, this causes handshakes to be retried in slightly less than 5 seconds, which means they aren't sent at all. This has the effect of the handshakes entirely stopping their retry cycle until the next data packet is sent. Reported-by: Andrew He <andrewhe@mit.edu>
* 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>
* 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.
* timers: switch to kees' new timer_list functionsJason A. Donenfeld2017-11-011-17/+17
|
* timers: guard entire setting in blockJason A. Donenfeld2017-10-311-4/+6
|
* global: style nitsJason A. Donenfeld2017-10-311-2/+4
|
* global: accept decent check_patch.pl suggestionsJason A. Donenfeld2017-10-311-4/+4
|
* global: add space around variable declarationsJason A. Donenfeld2017-10-031-0/+6
|
* timers: ensure safe timer removalJason A. Donenfeld2017-10-021-12/+17
|
* timers: convert to use netif_runningJason A. Donenfeld2017-09-241-19/+14
|
* queue: entirely rework parallel systemJason A. Donenfeld2017-09-181-8/+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.
* timers: styleJason A. Donenfeld2017-09-151-1/+1
|
* timers: do not send out double keepaliveJason A. Donenfeld2017-08-051-1/+4
| | | | | | It's possible that a persistent keepalive that comes before a normal keepalive will not invalidate the normal keepalive, and then we'll needlessly send two keepalives.
* timers: rename confusingly named functions and variablesJason A. Donenfeld2017-08-041-9/+9
| | | | Suggested-by: Mathias Hall-Andersen <mathias@hall-andersen.dk>
* receive: move lastminute guard into timer eventJason A. Donenfeld2017-08-041-0/+1
| | | | Suggested-by: Mathias Hall-Andersen <mathias@hall-andersen.dk>
* global: use pointer to net_deviceJason A. Donenfeld2017-07-201-4/+4
| | | | | | DaveM prefers it to be this way per [1]. [1] http://www.spinics.net/lists/netdev/msg443992.html
* timers: queue up killing ephemerals only if not alreadyJason A. Donenfeld2017-05-311-1/+1
|
* timers: reset retry-attempt counter when not retryingJason A. Donenfeld2017-05-311-2/+2
|
* timers: the completion of a handshake also is on key confirmationJason A. Donenfeld2017-05-311-2/+2
|
* timers: rework handshake reply control flowJason A. Donenfeld2017-05-311-9/+8
|
* debug: print interface name in dmesgJason A. Donenfeld2017-05-311-3/+5
|
* timers: fix typo in commentJason A. Donenfeld2017-05-301-1/+1
| | | | Suggested-by: Peter Wu <peter@lekensteyn.nl>
* handshake: process in parallelJason A. Donenfeld2017-05-301-1/+1
|
* data: cleanup parallel workqueue and use two max_activeJason A. Donenfeld2017-04-081-1/+1
|
* timers: elide enable checkJason A. Donenfeld2017-03-141-3/+3
|