Skip to content

Commit 6bcdc40

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: move rx_opt & syn_data_acked init to tcp_disconnect()
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>
1 parent 792c435 commit 6bcdc40

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

net/ipv4/tcp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,10 @@ int tcp_disconnect(struct sock *sk, int flags)
26172617
tp->rack.last_delivered = 0;
26182618
tp->rack.reo_wnd_persist = 0;
26192619
tp->rack.dsack_seen = 0;
2620+
tp->syn_data_acked = 0;
2621+
tp->rx_opt.saw_tstamp = 0;
2622+
tp->rx_opt.dsack = 0;
2623+
tp->rx_opt.num_sacks = 0;
26202624

26212625

26222626
/* Clean up fastopen related fields */

net/ipv4/tcp_minisocks.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
489489
tcp_init_xmit_timers(newsk);
490490
newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1;
491491

492-
newtp->rx_opt.saw_tstamp = 0;
493-
494-
newtp->rx_opt.dsack = 0;
495-
newtp->rx_opt.num_sacks = 0;
496-
497492
if (sock_flag(newsk, SOCK_KEEPOPEN))
498493
inet_csk_reset_keepalive_timer(newsk,
499494
keepalive_time_when(newtp));
@@ -534,7 +529,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
534529
tcp_ecn_openreq_child(newtp, req);
535530
newtp->fastopen_req = NULL;
536531
newtp->fastopen_rsk = NULL;
537-
newtp->syn_data_acked = 0;
538532

539533
__TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS);
540534

0 commit comments

Comments
 (0)