Skip to content

Commit aa27fc5

Browse files
Octavian Purdiladavem330
authored andcommitted
tcp: tcp_v[46]_conn_request: fix snt_synack initialization
Commit 016818d (tcp: TCP Fast Open Server - take SYNACK RTT after completing 3WHS) changes the code to only take a snt_synack timestamp when a SYNACK transmit or retransmit succeeds. This behaviour is later broken by commit 843f4a5 (tcp: use tcp_v4_send_synack on first SYN-ACK), as snt_synack is now updated even if tcp_v4_send_synack fails. Also, commit 3a19ce0 (tcp: IPv6 support for fastopen server) misses the required IPv6 updates for 016818d. This patch makes sure that snt_synack is updated only when the SYNACK trasnmit/retransmit succeeds, for both IPv4 and IPv6. Cc: Cardwell <[email protected]> Cc: Daniel Lee <[email protected]> Cc: Yuchung Cheng <[email protected]> Signed-off-by: Octavian Purdila <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 57b4755 commit aa27fc5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
13701370
goto drop_and_free;
13711371

13721372
tcp_rsk(req)->snt_isn = isn;
1373-
tcp_rsk(req)->snt_synack = tcp_time_stamp;
13741373
tcp_openreq_init_rwin(req, sk, dst);
13751374
fastopen = !want_cookie &&
13761375
tcp_try_fastopen(sk, skb, req, &foc, dst);
@@ -1380,7 +1379,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
13801379
if (err || want_cookie)
13811380
goto drop_and_free;
13821381

1383-
tcp_rsk(req)->snt_synack = tcp_time_stamp;
13841382
tcp_rsk(req)->listener = NULL;
13851383
inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);
13861384
}

net/ipv6/tcp_ipv6.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
497497
skb_set_queue_mapping(skb, queue_mapping);
498498
err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass);
499499
err = net_xmit_eval(err);
500+
if (!tcp_rsk(req)->snt_synack && !err)
501+
tcp_rsk(req)->snt_synack = tcp_time_stamp;
500502
}
501503

502504
done:
@@ -1100,7 +1102,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
11001102
goto drop_and_free;
11011103

11021104
tcp_rsk(req)->snt_isn = isn;
1103-
tcp_rsk(req)->snt_synack = tcp_time_stamp;
11041105
tcp_openreq_init_rwin(req, sk, dst);
11051106
fastopen = !want_cookie &&
11061107
tcp_try_fastopen(sk, skb, req, &foc, dst);

0 commit comments

Comments
 (0)