diff mbox

[1/2] tcp: setup random timestamp offset when write_seq already set

Message ID 309e3579-8cdb-ca96-f995-5629fa132e5c@oracle.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Alexey Kodanev Feb. 18, 2017, 9:19 a.m. UTC
Hi,
On 18.02.2017 3:56, Alexey Kodanev wrote:
> Found that when random offset enabled (default) TCP client can
> still start new connections with and without random offsets. Later,
> if server does active close and re-use sockets in TIME-WAIT state,
> new SYN from client can be rejected on PAWS check inside
> tcp_timewait_state_process().
>

Actually, on second thoughts, we can just copy tsoffset from tw socket:

        }

Will test this and send a new version.

Thanks,
Alexey
diff mbox

Patch

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 89a95da..f40a61d 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -126,6 +126,7 @@  int tcp_twsk_unique(struct sock *sk, struct sock
*sktw, void *twp)
                        tp->write_seq = 1;
                tp->rx_opt.ts_recent       = tcptw->tw_ts_recent;
                tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp;
+               tp->tsoffset               = tcptw->tw_ts_offset;
                sock_hold(sktw);
                return 1;