tcp: move rx_opt & syn_data_acked init to tcp_disconnect()
authorEric Dumazet <edumazet@google.com>
Thu, 17 Jan 2019 19:23:42 +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 2348199e6cee9b644177b1d5158680359fa2b57d..541bdb9f81d791ca84c7f03d9caf15d84066c32e 100644 (file)
@@ -2617,6 +2617,10 @@ int tcp_disconnect(struct sock *sk, int flags)
        tp->rack.last_delivered = 0;
        tp->rack.reo_wnd_persist = 0;
        tp->rack.dsack_seen = 0;
+       tp->syn_data_acked = 0;
+       tp->rx_opt.saw_tstamp = 0;
+       tp->rx_opt.dsack = 0;
+       tp->rx_opt.num_sacks = 0;
 
 
        /* Clean up fastopen related fields */
index 27e11eb4164ca18da0e939eb928b5b2442f300dd..182595e2d40ff5b48cd6d095d4bd97b4cb26d3c0 100644 (file)
@@ -489,11 +489,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
        tcp_init_xmit_timers(newsk);
        newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1;
 
-       newtp->rx_opt.saw_tstamp = 0;
-
-       newtp->rx_opt.dsack = 0;
-       newtp->rx_opt.num_sacks = 0;
-
        if (sock_flag(newsk, SOCK_KEEPOPEN))
                inet_csk_reset_keepalive_timer(newsk,
                                               keepalive_time_when(newtp));
@@ -534,7 +529,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
        tcp_ecn_openreq_child(newtp, req);
        newtp->fastopen_req = NULL;
        newtp->fastopen_rsk = NULL;
-       newtp->syn_data_acked = 0;
 
        __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS);