[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAJkE24+8NJfkgLRTvUiMyCC=qZ9bnKWTr7pBXtaC8YPMOyMfew@mail.gmail.com>
Date: Wed, 28 Mar 2012 22:21:59 +0800
From: Chao Pei <peichao85@...il.com>
To: netdev@...r.kernel.org
Subject: Question about timewait timer
Hi,
I have a qestion about timewait timer in tcp_keepalive_timer. In
the following code:
int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
const struct tcphdr *th, unsigned int len)
{
.....
case FIN_WAIT_1:
......
tmo = tcp_fin_time(sk);
if (tmo > TCP_TIMEWAIT_LEN) {
inet_csk_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN);
} else if (.....)
......
}
If tmo is larger than TCP_TIMEWAIT_LEN and the FIN flag is not
set, schedule keepalive timer. But in tcp_keepalive_timer, the timer
is set to tcp_fin_time(sk) -TCP_TIMEWAIT_LEN again. See the source
code below:
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;
}
}
.....
}
I think the first piece of code set keepalive timer to
tmo-TCP_TIMEWAIT_LEN is because TCP_TIMEWAIT_LEN is the longest timer
that tcp_death_row can handle. So the extra time should be taken care
of by the keepalive timer first. If this is correct, then the timer
should be set to TCP_TIMEWAIT_LEN in tcp_keepalive_timer, instead of
tcp_fin_time(sk) - TCP_TIMEWAIT_LEN.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists