From: Jason Xing <kerneljasonxing@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, dsahern@kernel.org, kuniyu@amazon.com
Cc: netdev@vger.kernel.org, Jason Xing <kernelxing@tencent.com>
Subject: [PATCH net-next v2 5/6] tcp: rstreason: introduce SK_RST_REASON_TCP_TIMEOUT for active reset
Date: Wed, 31 Jul 2024 20:09:54 +0800 [thread overview]
Message-ID: <20240731120955.23542-6-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20240731120955.23542-1-kerneljasonxing@gmail.com>
From: Jason Xing <kernelxing@tencent.com>
Whether user sets TCP_USER_TIMEOUT option or not, when we find there
is no left chance to proceed, we will send an RST to the other side.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
v2
Link: https://lore.kernel.org/all/CAL+tcoB-12pUS0adK8M_=C97aXewYYmDA6rJKLXvAXEHvEsWjA@mail.gmail.com/
1. correct the comment and changelog
---
include/net/rstreason.h | 8 ++++++++
net/ipv4/tcp_timer.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/net/rstreason.h b/include/net/rstreason.h
index bbf20d0bbde7..739ad1db4212 100644
--- a/include/net/rstreason.h
+++ b/include/net/rstreason.h
@@ -21,6 +21,7 @@
FN(TCP_ABORT_ON_LINGER) \
FN(TCP_ABORT_ON_MEMORY) \
FN(TCP_STATE) \
+ FN(TCP_TIMEOUT) \
FN(MPTCP_RST_EUNSPEC) \
FN(MPTCP_RST_EMPTCP) \
FN(MPTCP_RST_ERESOURCE) \
@@ -108,6 +109,13 @@ enum sk_rst_reason {
* Please see RFC 9293 for all possible reset conditions
*/
SK_RST_REASON_TCP_STATE,
+ /**
+ * @SK_RST_REASON_TCP_TIMEOUT: time to timeout
+ * Whether user sets TCP_USER_TIMEOUT options or not, when we
+ * have already run out of all the chances, we have to reset the
+ * connection
+ */
+ SK_RST_REASON_TCP_TIMEOUT,
/* Copy from include/uapi/linux/mptcp.h.
* These reset fields will not be changed since they adhere to
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 3910f6d8614e..bd403300e4c4 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -807,7 +807,7 @@ static void tcp_keepalive_timer (struct timer_list *t)
(user_timeout == 0 &&
icsk->icsk_probes_out >= keepalive_probes(tp))) {
tcp_send_active_reset(sk, GFP_ATOMIC,
- SK_RST_REASON_NOT_SPECIFIED);
+ SK_RST_REASON_TCP_TIMEOUT);
tcp_write_err(sk);
goto out;
}
--
2.37.3
next prev parent reply other threads:[~2024-07-31 12:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 12:09 [PATCH net-next v2 0/6] tcp: completely support active reset Jason Xing
2024-07-31 12:09 ` [PATCH net-next v2 1/6] tcp: rstreason: introduce SK_RST_REASON_TCP_ABORT_ON_CLOSE for " Jason Xing
2024-08-01 6:47 ` Eric Dumazet
2024-07-31 12:09 ` [PATCH net-next v2 2/6] tcp: rstreason: introduce SK_RST_REASON_TCP_ABORT_ON_LINGER " Jason Xing
2024-08-01 6:48 ` Eric Dumazet
2024-07-31 12:09 ` [PATCH net-next v2 3/6] tcp: rstreason: introduce SK_RST_REASON_TCP_ABORT_ON_MEMORY " Jason Xing
2024-08-01 6:49 ` Eric Dumazet
2024-07-31 12:09 ` [PATCH net-next v2 4/6] tcp: rstreason: introduce SK_RST_REASON_TCP_STATE " Jason Xing
2024-08-01 6:56 ` Eric Dumazet
2024-08-01 9:51 ` Jason Xing
2024-08-01 10:06 ` Eric Dumazet
2024-08-01 10:24 ` Jason Xing
2024-07-31 12:09 ` Jason Xing [this message]
2024-08-01 6:58 ` [PATCH net-next v2 5/6] tcp: rstreason: introduce SK_RST_REASON_TCP_TIMEOUT " Eric Dumazet
2024-08-01 9:30 ` Jason Xing
2024-07-31 12:09 ` [PATCH net-next v2 6/6] tcp: rstreason: let it work finally in tcp_send_active_reset() Jason Xing
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=20240731120955.23542-6-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--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;
as well as URLs for NNTP newsgroup(s).