aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_minisocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r--net/ipv4/tcp_minisocks.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 7e16243cdb58..692f974e5abe 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -94,7 +94,6 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
94 struct tcp_options_received tmp_opt; 94 struct tcp_options_received tmp_opt;
95 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw); 95 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
96 bool paws_reject = false; 96 bool paws_reject = false;
97 struct inet_timewait_death_row *tcp_death_row = &sock_net((struct sock*)tw)->ipv4.tcp_death_row;
98 97
99 tmp_opt.saw_tstamp = 0; 98 tmp_opt.saw_tstamp = 0;
100 if (th->doff > (sizeof(*th) >> 2) && tcptw->tw_ts_recent_stamp) { 99 if (th->doff > (sizeof(*th) >> 2) && tcptw->tw_ts_recent_stamp) {
@@ -149,12 +148,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
149 tcptw->tw_ts_recent = tmp_opt.rcv_tsval; 148 tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
150 } 149 }
151 150
152 if (tcp_death_row->sysctl_tw_recycle && 151 inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN);
153 tcptw->tw_ts_recent_stamp &&
154 tcp_tw_remember_stamp(tw))
155 inet_twsk_reschedule(tw, tw->tw_timeout);
156 else
157 inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN);
158 return TCP_TW_ACK; 152 return TCP_TW_ACK;
159 } 153 }
160 154
@@ -259,12 +253,8 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
259 const struct inet_connection_sock *icsk = inet_csk(sk); 253 const struct inet_connection_sock *icsk = inet_csk(sk);
260 const struct tcp_sock *tp = tcp_sk(sk); 254 const struct tcp_sock *tp = tcp_sk(sk);
261 struct inet_timewait_sock *tw; 255 struct inet_timewait_sock *tw;
262 bool recycle_ok = false;
263 struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row; 256 struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row;
264 257
265 if (tcp_death_row->sysctl_tw_recycle && tp->rx_opt.ts_recent_stamp)
266 recycle_ok = tcp_remember_stamp(sk);
267
268 tw = inet_twsk_alloc(sk, tcp_death_row, state); 258 tw = inet_twsk_alloc(sk, tcp_death_row, state);
269 259
270 if (tw) { 260 if (tw) {
@@ -317,13 +307,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
317 if (timeo < rto) 307 if (timeo < rto)
318 timeo = rto; 308 timeo = rto;
319 309
320 if (recycle_ok) { 310 tw->tw_timeout = TCP_TIMEWAIT_LEN;
321 tw->tw_timeout = rto; 311 if (state == TCP_TIME_WAIT)
322 } else { 312 timeo = TCP_TIMEWAIT_LEN;
323 tw->tw_timeout = TCP_TIMEWAIT_LEN;
324 if (state == TCP_TIME_WAIT)
325 timeo = TCP_TIMEWAIT_LEN;
326 }
327 313
328 inet_twsk_schedule(tw, timeo); 314 inet_twsk_schedule(tw, timeo);
329 /* Linkage updates. */ 315 /* Linkage updates. */