Patchwork [1/2] tcp: fix too short FIN_WAIT2 time out

login
register
mail settings
Submitter Toshiaki Makita
Date Feb. 12, 2013, 12:52 p.m.
Message ID <1360673521.10638.12.camel@ubuntu-vm-makita>
Download mbox | patch
Permalink /patch/219852/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Toshiaki Makita - Feb. 12, 2013, 12:52 p.m.
When tcp_fin_timeout is between 60 and 120, FIN_WAIT2 socket
disappears in (tcp_fin_timeout - 60) * 2 sec, which is shorter
than expected.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 net/ipv4/tcp_timer.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

Patch

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index b78aac3..c20e474 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -576,12 +576,8 @@  static void tcp_keepalive_timer (unsigned long data)
 
 	if (sk->sk_state == TCP_FIN_WAIT2 && sock_flag(sk, SOCK_DEAD)) {
 		if (tp->linger2 >= 0) {
-			const int tmo = tcp_fin_time(sk) - TCP_TIMEWAIT_LEN;
-
-			if (tmo > 0) {
-				tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
-				goto out;
-			}
+			tcp_time_wait(sk, TCP_FIN_WAIT2, TCP_TIMEWAIT_LEN);
+			goto out;
 		}
 		tcp_send_active_reset(sk, GFP_ATOMIC);
 		goto death;