tcp: move retrans_out, sacked_out, tlp_high_seq, last_oow_ack_time init to tcp_discon...
authorEric Dumazet <edumazet@google.com>
Thu, 17 Jan 2019 19:23:39 +0000 (11:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jan 2019 06:19:05 +0000 (22:19 -0800)
If we make sure all listeners have these fields cleared, then a clone
will also inherit zero values.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c
net/ipv4/tcp_minisocks.c

index 3f99ad92eaedb2364e339842365f553fca8922e1..551ad8604bea0cb459805165bb216a99fd3bd8e2 100644 (file)
@@ -2605,6 +2605,10 @@ int tcp_disconnect(struct sock *sk, int flags)
        tp->duplicate_sack[0].end_seq = 0;
        tp->dsack_dups = 0;
        tp->reord_seen = 0;
+       tp->retrans_out = 0;
+       tp->sacked_out = 0;
+       tp->tlp_high_seq = 0;
+       tp->last_oow_ack_time = 0;
 
        /* Clean up fastopen related fields */
        tcp_free_fastopen_req(tp);
index 2747aa72b8e2b5c190c2c3e68a7dea04ee97dcac..29fba13849a79695b3f62a989b27157b57caedfb 100644 (file)
@@ -482,12 +482,8 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
        minmax_reset(&newtp->rtt_min, tcp_jiffies32, ~0U);
        newicsk->icsk_ack.lrcvtime = tcp_jiffies32;
 
-       newtp->retrans_out = 0;
-       newtp->sacked_out = 0;
-       newtp->tlp_high_seq = 0;
        newtp->lsndtime = tcp_jiffies32;
        newsk->sk_txhash = treq->txhash;
-       newtp->last_oow_ack_time = 0;
        newtp->total_retrans = req->num_retrans;
 
        /* There's a bubble in the pipe until at least the first ACK. */