Subject: Re: [PATCH net] tcp: randomize timestamps on syncookies

From: Florian Westphal <[email-masked]>
Date: Fri, 5 May 2017 02:24:56 +0200

Eric Dumazet <[email-masked]> wrote:
> From: Eric Dumazet <[email-masked]>
> 
> 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, it is not used from
> a module.

I like the direction, but this is incomplete.

>  	if (want_cookie) {
>  		isn = cookie_init_sequence(af_ops, sk, skb, &req->mss);
> -		tcp_rsk(req)->ts_off = 0;

This breaks syncookies w. timestamps; cookie_timestamp_decode() lacks a tsoff
for readjustment.

We also need to pass the (recomputed) tsoff to tcp_get_cookie_sock().

Other than this, this patch looks good to me, thanks!