TCP: avoid to send keepalive probes if receiving data
RFC 1122 says the following: ... Keep-alive packets MUST only be sent when no data or acknowledgement packets have been received for the connection within an interval. ... The acknowledgement packet is reseting the keepalive timer but the data packet isn't. This patch fixes it by checking the timestamp of the last received data packet too when the keepalive timer expires. Signed-off-by: Flavio Leitner <fleitner@redhat.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
dcdca2c49b
commit
6c37e5de45
@@ -2298,7 +2298,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
|
||||
if (sock_flag(sk, SOCK_KEEPOPEN) &&
|
||||
!((1 << sk->sk_state) &
|
||||
(TCPF_CLOSE | TCPF_LISTEN))) {
|
||||
__u32 elapsed = tcp_time_stamp - tp->rcv_tstamp;
|
||||
u32 elapsed = keepalive_time_elapsed(tp);
|
||||
if (tp->keepalive_time > elapsed)
|
||||
elapsed = tp->keepalive_time - elapsed;
|
||||
else
|
||||
|
Reference in New Issue
Block a user