linux/drivers/net/wireguard
Jason A. Donenfeld c78a0b4a78 wireguard: queueing: preserve flow hash across packet scrubbing
It's important that we clear most header fields during encapsulation and
decapsulation, because the packet is substantially changed, and we don't
want any info leak or logic bug due to an accidental correlation. But,
for encapsulation, it's wrong to clear skb->hash, since it's used by
fq_codel and flow dissection in general. Without it, classification does
not proceed as usual. This change might make it easier to estimate the
number of innerflows by examining clustering of out of order packets,
but this shouldn't open up anything that can't already be inferred
otherwise (e.g. syn packet size inference), and fq_codel can be disabled
anyway.

Furthermore, it might be the case that the hash isn't used or queried at
all until after wireguard transmits the encrypted UDP packet, which
means skb->hash might still be zero at this point, and thus no hash
taken over the inner packet data. In order to address this situation, we
force a calculation of skb->hash before encrypting packet data.

Of course this means that fq_codel might transmit packets slightly more
out of order than usual. Toke did some testing on beefy machines with
high quantities of parallel flows and found that increasing the
reply-attack counter to 8192 takes care of the most pathological cases
pretty well.

Reported-by: Dave Taht <dave.taht@gmail.com>
Reviewed-and-tested-by: Toke Høiland-Jørgensen <toke@toke.dk>
Fixes: e7096c131e ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-20 20:55:09 -07:00
..
selftest wireguard: selftests: initalize ipv6 members to NULL to squelch clang warning 2020-05-06 20:03:47 -07:00
allowedips.c wireguard: allowedips: fix use-after-free in root_remove_peer_lists 2020-02-05 14:14:18 +01:00
allowedips.h
cookie.c
cookie.h
device.c wireguard: queueing: account for skb->protocol==0 2020-03-18 18:51:43 -07:00
device.h net: introduce skb_list_walk_safe for skb segment walking 2020-01-08 15:19:54 -08:00
main.c wireguard: main: remove unused include <linux/version.h> 2019-12-16 19:22:22 -08:00
Makefile
messages.h wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
netlink.c wireguard: noise: error out precomputed DH during handshake rather than config 2020-03-18 18:51:43 -07:00
netlink.h
noise.c wireguard: noise: read preshared key while taking lock 2020-05-20 20:55:09 -07:00
noise.h wireguard: noise: error out precomputed DH during handshake rather than config 2020-03-18 18:51:43 -07:00
peer.c wireguard: noise: error out precomputed DH during handshake rather than config 2020-03-18 18:51:43 -07:00
peer.h
peerlookup.c
peerlookup.h
queueing.c wireguard: queueing: cleanup ptr_ring in error path of packet_queue_init 2020-04-29 14:23:05 -07:00
queueing.h wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
ratelimiter.c
ratelimiter.h
receive.c wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
send.c wireguard: queueing: preserve flow hash across packet scrubbing 2020-05-20 20:55:09 -07:00
socket.c wireguard: socket: remove errant restriction on looping to self 2020-05-06 20:03:47 -07:00
socket.h
timers.c
timers.h
version.h