]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: randomize timestamps on syncookies
authorEric Dumazet <edumazet@google.com>
Fri, 5 May 2017 13:56:54 +0000 (06:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 May 2017 16:00:11 +0000 (12:00 -0400)
commit2f7277d9c49e285a3823f96d8c8d39980373c337
tree53778bfd4964bed65ac40a9c1c57a73f21cb9664
parente446ed85ae46638916e5607e734a07fc3beeb4da
tcp: randomize timestamps on syncookies

Whole point of randomization was to hide server uptime, but an attacker
can simply start a syn flood and TCP generates 'old style' timestamps,
directly revealing server jiffies value.

Also, TSval sent by the server to a particular remote address vary
depending on syncookies being sent or not, potentially triggering PAWS
drops for innocent clients.

Lets implement proper randomization, including for SYNcookies.

Also we do not need to export sysctl_tcp_timestamps, since it is not
used from a module.

In v2, I added Florian feedback and contribution, adding tsoff to
tcp_get_cookie_sock().

v3 removed one unused variable in tcp_v4_connect() as Florian spotted.

Fixes: 6d22703b350fd ("tcp: randomize tcp timestamp offsets for each connection")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
Tested-by: Florian Westphal <fw@strlen.de>
Cc: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/secure_seq.h
include/net/tcp.h
net/core/secure_seq.c
net/ipv4/syncookies.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv6/syncookies.c
net/ipv6/tcp_ipv6.c