Skip to content

Commit 9e450c1

Browse files
yuchungchengdavem330
authored andcommitted
tcp: better SYNACK sent timestamp
Detecting spurious SYNACK timeout using timestamp option requires recording the exact SYNACK skb timestamp. Previously the SYNACK sent timestamp was stamped slightly earlier before the skb was transmitted. This patch uses the SYNACK skb transmission timestamp directly. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7c1f081 commit 9e450c1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6319,7 +6319,7 @@ static void tcp_openreq_init(struct request_sock *req,
63196319
req->cookie_ts = 0;
63206320
tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
63216321
tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
6322-
tcp_rsk(req)->snt_synack = tcp_clock_us();
6322+
tcp_rsk(req)->snt_synack = 0;
63236323
tcp_rsk(req)->last_oow_ack_time = 0;
63246324
req->mss = rx_opt->mss_clamp;
63256325
req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;

net/ipv4/tcp_output.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,11 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
32473247
skb->skb_mstamp_ns = cookie_init_timestamp(req);
32483248
else
32493249
#endif
3250+
{
32503251
skb->skb_mstamp_ns = tcp_clock_ns();
3252+
if (!tcp_rsk(req)->snt_synack) /* Timestamp first SYNACK */
3253+
tcp_rsk(req)->snt_synack = tcp_skb_timestamp_us(skb);
3254+
}
32513255

32523256
#ifdef CONFIG_TCP_MD5SIG
32533257
rcu_read_lock();

0 commit comments

Comments
 (0)