From: Lizhe <sensor1010@163.com>
To: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Lizhe <sensor1010@163.com>
Subject: [PATCH] tcp: Add an extra check for consecutive failed keepalive probes
Date: Fri, 10 Jan 2025 00:18:02 +0800 [thread overview]
Message-ID: <20250109161802.3599-1-sensor1010@163.com> (raw)
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
next reply other threads:[~2025-01-09 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 16:18 Lizhe [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109161802.3599-1-sensor1010@163.com \
--to=sensor1010@163.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®