aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
* wg-quick: experiment with ifgroup suppressionjd/ifgroupJason A. Donenfeld2018-11-121-26/+25
|
* chacha20: import .pl for chacha20Jason A. Donenfeld2018-11-123-2632/+5538
|
* crypto: use CONFIG_KERNEL_MODE_NEON in .plJason A. Donenfeld2018-11-094-8/+11
| | | | | | While Andy is right to desire a separation between compiler defines and project defines, there are simply too many odd kernel configurations and we require testing for CONFIG_KERNEL_MODE_NEON.
* crypto: switch to perlasm originalsJason A. Donenfeld2018-11-0915-6107/+5573
|
* keygen-html: add missing glue macroJason A. Donenfeld2018-11-061-0/+1
|
* compat: csum_levels is new in 3.18 but backported to RHELJason A. Donenfeld2018-11-052-0/+3
|
* qemu: bump default kernelJason A. Donenfeld2018-10-271-1/+1
|
* send: calculate inner checksums for all protocolsAndrejs Hanins2018-10-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm using GRE tunnel (transparent Ethernet bridging flavor) over WireGuard interface to be able to bridge L2 network segments. The typical protocol chain looks like this IP->GRE->EthernetHeader->IP->UDP. UDP here is the packet sent from the L2 network segment which is tunneled using GRE over Wireguard. Indeed, there is a checksum inside UDP header which is, as a rule, kept partially calculated while packet travels through network stack and outer protocols are added until the packet reaches WG device which exposes NETIF_F_HW_CSUM feature meaning it can handle checksum offload for all protocols. But the problem here is that skb_checksum_setup called from encrypt_packet handles only TCP/UDP protocols under top level IP, but in my case there is a GRE protocol there, so skb_checksum_help is not called and packet continues its life with unfinished (broken) checksum and gets encrypted as-is. When such packet is received by other side and reaches L2 networks it's seen there with a broken checksum inside the UDP header. The fact that Wireguard on the receiving side sets skb->ip_summed to CHECKSUM_UNNECESSARY partially mitigates the problem by telling network stack on the receiving side that validation of the checksum is not necessary, so local TCP stack, for example, works fine. But it doesn't help in situations when packet needs to be forwarded further (sent out from the box). In this case there is no way we can tell next hop that checksum verification for this packet is not necessary, we just send it out with bad checksum and packet gets dropped on the next hop box. I think the issue of the original code was the wrong usage of skb_checksum_setup, simply because it's not needed in this case. Instead, we can just rely on ip_summed skb field to see if partial checksum needs to be finalized or not. Note that many other drivers in kernel follow this approach. In summary: - skb_checksum_setup can only handle TCP/UDP protocols under top level IP header, packets with other protocols (like GRE) are sent out by Wireguard with unfinished partial checksums which causes problems on receiving side (bad checksums). - encrypt_packet gets skb prepared by network stack, so there is no need to setup the checksum from scratch, but just perform hw checksum offload using software helper skb_checksum_help for packet which explicitly require it as denoted by CHECKSUM_PARTIAL. Signed-off-by: Andrejs Hanins <ahanins@gmail.com>
* receive: assume all levels have been checksumed, not just outerJason A. Donenfeld2018-10-271-0/+7
| | | | This means we do less computation on encapsulated payloads.
* device: do not clear keys on sleep for PM_AUTOSLEEPJason A. Donenfeld2018-10-271-4/+11
| | | | | | | | | | | This way other devices that use Android style wakelocks will also have the same semantics. We also move this logic into the handler so that it's slightly cleaner and gives us some opportunity to leave a normal comment. Suggested-by: Theodore Ts'o <tytso@mit.edu> Suggested-by: Andrew Lunn <andrew@lunn.ch> Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
* curve25519-x86_64: this was relicensed to BSD-3-Clause upstreamJason A. Donenfeld2018-10-271-1/+1
|
* timers: it is always reasonable to remove a timerJason A. Donenfeld2018-10-273-17/+6
| | | | | | | | | | | | | | 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.
* ratelimiter: make hash calls explicitJason A. Donenfeld2018-10-271-11/+14
|
* makefile: include selftests in style checkJason A. Donenfeld2018-10-271-1/+1
|
* 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.
* allowedips: fix sparse warnings in optional selftestsJason A. Donenfeld2018-10-271-12/+14
|
* poly1305-donna64: mark large constants as ULLJason A. Donenfeld2018-10-271-24/+24
|
* send: consider dropped stage packets to be droppedJason A. Donenfeld2018-10-275-4/+15
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* allowedips: fix up macros and annotationsJason A. Donenfeld2018-10-251-63/+70
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* ratelimiter: refcounter doesn't need to be atomicJason A. Donenfeld2018-10-251-4/+4
| | | | Suggested-by: Jann Horn <jann@thejh.net>
* global: do not allow compiler to reorder is_valid or is_deadJason A. Donenfeld2018-10-254-14/+17
| | | | Suggested-by: Jann Horn <jann@thejh.net>
* peer: another peer_remove cleanupJason A. Donenfeld2018-10-252-12/+42
|
* wg.8: AllowedIPs isn't actually requiredJason A. Donenfeld2018-10-191-1/+1
| | | | | | | An empty allowed IPs is totally valid, for folks wishing to move IP addresses between multiple peers atomically. Suggested-by: Comex <comexk@gmail.com>
* wg.8: specify that wg(8) shows runtime info tooJason A. Donenfeld2018-10-191-1/+1
| | | | Suggested-by: Comex <comexk@gmail.com>
* version: bump snapshot0.0.20181018Jason A. Donenfeld2018-10-182-2/+2
|
* tools: wg-quick: wait for interface to disappear on freebsdJason A. Donenfeld2018-10-131-0/+9
|
* tools: don't fail if a netlink interface dump is inconsistentJason A. Donenfeld2018-10-132-4/+18
| | | | | | | | | | Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed during the dump. That's unfortunate, but is pretty common on busy systems that are adding and removing tunnels all the time. Rather than retrying, potentially indefinitely, we just work with the partial results. Reported-by: Robert Gerus <ar@is-a.cat>
* main: get rid of unloaded debug messageJason A. Donenfeld2018-10-101-1/+0
|
* tools: compile on gnu99Jason A. Donenfeld2018-10-091-1/+1
| | | | | | | We don't actually use any C11 features, so we can at least compile with ancient gcc. Reported-by: Aaron M. D. Jones <aaronmdjones@gmail.com>
* tools: use libc's endianness macro if no compiler macroJason A. Donenfeld2018-10-091-0/+10
| | | | | | This lets us be compiled with ancient gcc. Reported-by: Jeff Brandt <jeff@jeffcolo.net>
* global: give if statements brackets and other cleanupsJason A. Donenfeld2018-10-0910-27/+40
|
* main: change module descriptionJason A. Donenfeld2018-10-081-1/+1
| | | | Suggested-by: Jiri Pirko <jiri@resnulli.us>
* device: use textual error labels alwaysJason A. Donenfeld2018-10-081-22/+23
| | | | Suggested-by: Jiri Pirko <jiri@resnulli.us>
* 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>
* timers: avoid using control statements in macroJason A. Donenfeld2018-10-081-8/+23
| | | | Suggested-by: Andrew Lunn <andrew@lunn.ch>
* allowedips: remove control statement from macro by rewritingJason A. Donenfeld2018-10-081-68/+119
| | | | | | | This is a significant rearrangement that makes things less clear, to satisfy a checkpatch.pl requirement. Suggested-by: Andrew Lunn <andrew@lunn.ch>
* global: more nitsJason A. Donenfeld2018-10-0817-83/+91
|
* global: rename struct wireguard_ to struct wg_Jason A. Donenfeld2018-10-0823-236/+225
| | | | | | 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-084-34/+25
| | | | | | | 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>
* qemu: kill after 20 minutesJason A. Donenfeld2018-10-081-1/+1
|
* compat: look in Kbuild and Makefile since they differ based on archJason A. Donenfeld2018-10-081-1/+1
|
* create-patch: blacklist instead of whitelistJason A. Donenfeld2018-10-081-1/+2
| | | | | | This will deal with filename changes more gracefully. Reported-by: Jordan Glover <Golden_Miller83@protonmail.ch>
* global: prefix functions used in callbacks with wg_Jason A. Donenfeld2018-10-089-90/+95
| | | | Suggested-by: Jiri Pirko <jiri@resnulli.us>
* compat: don't output for grep errorsDavide Garberi2018-10-071-2/+2
| | | | | | | | This will make it so that kernels not having arch/$(SRCARCH)/Kbuild no longer give any (non-fatal) grep errors such as "grep: arch/arm64/Kbuild: No such file or directory". Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
* version: bump snapshot0.0.20181007Jason A. Donenfeld2018-10-072-2/+2
|
* global: style nitsJason A. Donenfeld2018-10-075-32/+30
|
* crypto: clean up remaining .h->.cJason A. Donenfeld2018-10-0711-14/+14
|
* allowedips: document additional nobsJason A. Donenfeld2018-10-071-0/+12
|
* makefile: do more generic wildcard so as to avoid rename issuesJason A. Donenfeld2018-10-072-2/+2
| | | | | | | Commit ad5e4210 (global: rename include'd C files to be .c) breaks install target for dkms sources. Fix installing selftest/*.c. Suggested-by: Christian Hesse <mail@eworm.de>
* crypto: use BIT(i) & bitmap instead of (bitmap >> i) & 1Jason A. Donenfeld2018-10-071-2/+2
| | | | | | | | | | | Pros: clearer if you're not familiar with the shift idiom, uses kernel macro. Cons: doesn't work any more if the lvalue ever ceases to be a bool. Neutral: generates the same machine code. Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>