Skip to content

Commit 15bb774

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
tcp: initialize icsk_ack.lrcvtime at session start time
icsk_ack.lrcvtime has a 0 value at socket creation time. tcpi_last_data_recv can have bogus value if no payload is ever received. This patch initializes icsk_ack.lrcvtime for active sessions in tcp_finish_connect(), and for passive sessions in tcp_create_openreq_child() Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1d2a6a5 commit 15bb774

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5541,6 +5541,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
55415541
struct inet_connection_sock *icsk = inet_csk(sk);
55425542

55435543
tcp_set_state(sk, TCP_ESTABLISHED);
5544+
icsk->icsk_ack.lrcvtime = tcp_time_stamp;
55445545

55455546
if (skb) {
55465547
icsk->icsk_af_ops->sk_rx_dst_set(sk, skb);
@@ -5759,7 +5760,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
57595760
* to stand against the temptation 8) --ANK
57605761
*/
57615762
inet_csk_schedule_ack(sk);
5762-
icsk->icsk_ack.lrcvtime = tcp_time_stamp;
57635763
tcp_enter_quickack_mode(sk);
57645764
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
57655765
TCP_DELACK_MAX, TCP_RTO_MAX);

net/ipv4/tcp_minisocks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
460460
newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
461461
minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U);
462462
newicsk->icsk_rto = TCP_TIMEOUT_INIT;
463+
newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
463464

464465
newtp->packets_out = 0;
465466
newtp->retrans_out = 0;

0 commit comments

Comments
 (0)