netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time
@ 2017-03-22 15:10 Eric Dumazet
  2017-03-22 18:13 ` Neal Cardwell
  2017-03-22 22:40 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-03-22 15:10 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

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 <edumazet@google.com>
---
 net/ipv4/tcp_input.c     |    2 +-
 net/ipv4/tcp_minisocks.c |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 39c393cc0fd3c17130cd5d8d8b37f31ad3aeafd9..c43119726a62e494063fd940001b483215d0fe26 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5541,6 +5541,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
 	struct inet_connection_sock *icsk = inet_csk(sk);
 
 	tcp_set_state(sk, TCP_ESTABLISHED);
+	icsk->icsk_ack.lrcvtime = tcp_time_stamp;
 
 	if (skb) {
 		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,
 			 * to stand against the temptation 8)     --ANK
 			 */
 			inet_csk_schedule_ack(sk);
-			icsk->icsk_ack.lrcvtime = tcp_time_stamp;
 			tcp_enter_quickack_mode(sk);
 			inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
 						  TCP_DELACK_MAX, TCP_RTO_MAX);
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 7e16243cdb58c830f869fe483730e86400e2eb00..65c0f3d13eca47c6394c09925decf54287d01b48 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -460,6 +460,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
 		newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
 		minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U);
 		newicsk->icsk_rto = TCP_TIMEOUT_INIT;
+		newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
 
 		newtp->packets_out = 0;
 		newtp->retrans_out = 0;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time
  2017-03-22 15:10 [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time Eric Dumazet
@ 2017-03-22 18:13 ` Neal Cardwell
  2017-03-22 22:40 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2017-03-22 18:13 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Wed, Mar 22, 2017 at 11:10 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> 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 <edumazet@google.com>
> ---

Thanks, Eric!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time
  2017-03-22 15:10 [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time Eric Dumazet
  2017-03-22 18:13 ` Neal Cardwell
@ 2017-03-22 22:40 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-03-22 22:40 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 22 Mar 2017 08:10:21 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> 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 <edumazet@google.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-22 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-22 15:10 [PATCH net] tcp: initialize icsk_ack.lrcvtime at session start time Eric Dumazet
2017-03-22 18:13 ` Neal Cardwell
2017-03-22 22:40 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).