mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tcp: Add an extra check for consecutive failed keepalive probes
@ 2025-01-09 16:18 Lizhe
  2025-01-09 16:31 ` Neal Cardwell
  0 siblings, 1 reply; 4+ messages in thread
From: Lizhe @ 2025-01-09 16:18 UTC (permalink / raw)
  To: edumazet, davem, dsahern, kuba, pabeni, horms; +Cc: netdev, linux-kernel, Lizhe

Add an additional check to handle situations where consecutive
keepalive probe packets are sent without receiving a response.

Signed-off-by: Lizhe <sensor1010@163.com>
---
 net/ipv4/tcp_timer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index b412ed88ccd9..5a5dee8cd6d3 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -828,6 +828,12 @@ static void tcp_keepalive_timer (struct timer_list *t)
 		}
 		if (tcp_write_wakeup(sk, LINUX_MIB_TCPKEEPALIVE) <= 0) {
 			icsk->icsk_probes_out++;
+			if (icsk->icsk_probes_out >= keepalive_probes(tp)) {
+				tcp_send_active_reset(sk, GFP_ATOMIC,
+						SK_RST_REASON_TCP_KEEPALIVE_TIMEOUT);
+				tcp_write_err(sk);
+				goto out;
+			}
 			elapsed = keepalive_intvl_when(tp);
 		} else {
 			/* If keepalive was lost due to local congestion,
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-10 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09 16:18 [PATCH] tcp: Add an extra check for consecutive failed keepalive probes Lizhe
2025-01-09 16:31 ` Neal Cardwell
     [not found]   ` <5d5290fb.a567.19450f031bf.Coremail.sensor1010@163.com>
2025-01-10 16:24     ` Neal Cardwell
     [not found]     ` <CANn89iJLg1TKoFFaNtDOjFpyLW+YmxgSBCZQ4oTuJXX=RsKNzA@mail.gmail.com>
2025-01-10 16:28       ` Neal Cardwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®