aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/netlink.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* netlink: use __kernel_timespec for handshake timeJason A. Donenfeld2019-01-231-3/+7
|
* global: update copyrightJason A. Donenfeld2019-01-071-1/+1
|
* netlink: auth socket changes against namespace of socketJason A. Donenfeld2018-12-301-0/+7
| | | | | | | | | | | | | | | | | | In WireGuard, the underlying UDP socket lives in the namespace where the interface was created and doesn't move if the interface is moved. This allows one to create the interface in some privileged place that has Internet access, and then move it into a container namespace that only has the WireGuard interface for egress. Consider the following situation: 1. Interface created in namespace A. Socket therefore lives in namespace A. 2. Interface moved to namespace B. Socket remains in namespace A. 3. Namespace B now has access to the interface and changes the listen port and/or fwmark of socket. Change is reflected in namespace A. This behavior is arguably _fine_ and perhaps even expected or acceptable. But there's also an argument to be made that B should have A's cred to do so. So, this patch adds a simple ns_capable check.
* global: more nitsJason A. Donenfeld2018-10-081-7/+7
|
* global: rename struct wireguard_ to struct wg_Jason A. Donenfeld2018-10-081-20/+20
| | | | | | This required a bit of pruning of our christmas trees. Suggested-by: Jiri Pirko <jiri@resnulli.us>
* netlink: do not stuff index into nla typeJason A. Donenfeld2018-10-081-18/+11
| | | | | | | It's not used for anything, and LKML doesn't like the type being used as an index value. Suggested-by: Eugene Syromiatnikov <esyr@redhat.com>
* global: prefix functions used in callbacks with wg_Jason A. Donenfeld2018-10-081-8/+8
| | | | Suggested-by: Jiri Pirko <jiri@resnulli.us>
* global: prefix all functions with wg_Jason A. Donenfeld2018-10-021-34/+34
| | | | | | | | | | | | | 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.
* netlink: reverse my christmas treesJason A. Donenfeld2018-09-201-10/+11
|
* global: always find OOM unlikelyJason A. Donenfeld2018-09-041-3/+3
| | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: prefer sizeof(*pointer) when possibleJason A. Donenfeld2018-09-041-5/+4
| | | | Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* global: satisfy check_patch.pl errorsJason A. Donenfeld2018-09-031-18/+18
|
* netlink: insert peer version placeholderJason A. Donenfeld2018-09-021-2/+10
| | | | | | | While we don't want people to ever use old protocols, people will complain if the API "changes", so explicitly make the unset protocol mean the latest, and add a dummy mechanism of specifying the protocol on a per-peer basis, which we hope nobody actually ever uses.
* global: run through clang-formatJason A. Donenfeld2018-08-281-65/+150
| | | | | | | 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.
* netlink: don't start over iteration on multipart non-first allowedipsJason A. Donenfeld2018-08-091-2/+4
| | | | Reported-by: Matt Layher <mdlayher@gmail.com>
* peer: simplify rcu reference countsJason A. Donenfeld2018-07-311-3/+5
| | | | | | | Use RCU reference counts only when we must, and otherwise use a more reasonably named function. Reported-by: Jann Horn <jann@thejh.net>
* global: use ktime boottime instead of jiffiesJason A. Donenfeld2018-06-231-2/+2
| | | | | | | | 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.
* netlink: maintain static_identity lock over entire private key updateJason A. Donenfeld2018-06-181-0/+2
| | | | | We don't want the local private key to not correspond with a precomputed ss or precomputed cookie hash at any intermediate point.
* global: year bumpJason A. Donenfeld2018-01-031-1/+1
|
* compat: kernels < 3.13 modified genl_opsJason A. Donenfeld2017-12-211-1/+6
|
* 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>
* netlink: rename symbol to avoid clashesJason A. Donenfeld2017-11-291-2/+2
| | | | At somepoint we may need to wg_ namespace these.
* compat: support 4.15's netlink and barrier changesJason A. Donenfeld2017-11-261-1/+1
|
* global: switch from timeval to timespecJason A. Donenfeld2017-11-221-2/+2
| | | | | | | | | | | | | | | | | | | 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.
* socket: only free socket after successful creation of newJason A. Donenfeld2017-11-171-4/+4
| | | | | | | | | | | | | | When an interface is down, the socket port can change freely. A socket will be allocated when the interface comes up, and if a socket can't be allocated, the interface doesn't come up. However, a socket port can change while the interface is up. In this case, if a new socket with a new port cannot be allocated, it's important to keep the interface in a consistent state. The choices are either to bring down the interface or to preserve the old socket. This patch implements the latter. Reported-by: Marc-Antoine Perennou <keruspe@exherbo.org>
* curve25519: reject deriving from NULL private keysJason A. Donenfeld2017-11-111-7/+9
| | | | | These aren't actually valid 25519 points pre-normalization, and doing this is required to make unsetting private keys based on all zeros.
* allowedips: rename from routingtableJason A. Donenfeld2017-11-101-8/+8
| | | | Makes it more clear that this _not_ a routing table replacement.
* netlink: plug memory leakJason A. Donenfeld2017-11-031-1/+1
|
* compat: unbreak unloading on kernels 4.6 through 4.9Jason A. Donenfeld2017-11-011-1/+4
|
* global: style nitsJason A. Donenfeld2017-10-311-4/+7
|
* global: infuriating kernel iterator styleJason A. Donenfeld2017-10-311-6/+6
| | | | | | | | | | | | | | | | | 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: get rid of peer_for_each magicJason A. Donenfeld2017-10-311-5/+5
| | | | | | | | | Since the peer list is protected by the device_update_lock, and since items are removed from the peer list before putting their final reference, we don't actually need to take a reference when iterating. This allows us to simplify the macro considerably. Suggested-by: Johannes Berg <johannes@sipsolutions.net>
* global: accept decent check_patch.pl suggestionsJason A. Donenfeld2017-10-311-0/+7
|
* compat: just make ro_after_init read_mostlyJason A. Donenfeld2017-10-171-3/+1
|
* compat: move version logic to compat.h and out of main .cJason A. Donenfeld2017-10-111-2/+2
|
* routingtable: iterate progressivelyJason A. Donenfeld2017-10-091-16/+21
|
* routingtable: only use device's mutex, not a special rt oneJason A. Donenfeld2017-10-091-4/+4
|
* compat: macro rewrite netlink instead of clutteringJason A. Donenfeld2017-10-051-19/+10
|
* global: add space around variable declarationsJason A. Donenfeld2017-10-031-0/+6
|
* netlink: switch from ioctl to netlink for configurationJason A. Donenfeld2017-10-021-0/+494