* [PATCH net-next] tcp: rstreason: introduce SK_RST_REASON_TCP_LISTEN_OVERFLOW
@ 2026-12-01 10:00 Jiayuan Chen
0 siblings, 0 replies; only message in thread
From: Jiayuan Chen @ 2026-12-01 10:00 UTC (permalink / raw)
To: netdev
Cc: Jiayuan Chen, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Willem de Bruijn, Simon Horman, Neal Cardwell,
Kuniyuki Iwashima
In tcp_check_req(), the RST sent for accept queue overflow and others
and the RST sent for a SYN in window both use
SK_RST_REASON_INVALID_SYN, so the tcp_send_reset tracepoint can not
tell them apart.
Add SK_RST_REASON_TCP_LISTEN_OVERFLOW for the former.
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
---
include/net/rstreason.h | 6 ++++++
net/ipv4/tcp_minisocks.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/net/rstreason.h b/include/net/rstreason.h
index 979ac87b5d994..05bcc84b740c3 100644
--- a/include/net/rstreason.h
+++ b/include/net/rstreason.h
@@ -23,6 +23,7 @@
FN(TCP_STATE) \
FN(TCP_KEEPALIVE_TIMEOUT) \
FN(TCP_DISCONNECT_WITH_DATA) \
+ FN(TCP_LISTEN_OVERFLOW) \
FN(MPTCP_RST_EUNSPEC) \
FN(MPTCP_RST_EMPTCP) \
FN(MPTCP_RST_ERESOURCE) \
@@ -123,6 +124,11 @@ enum sk_rst_reason {
* disconnecting, so we have to send an RST.
*/
SK_RST_REASON_TCP_DISCONNECT_WITH_DATA,
+ /**
+ * @SK_RST_REASON_TCP_LISTEN_OVERFLOW: listener queue full
+ * Only sent when net.ipv4.tcp_abort_on_overflow is set.
+ */
+ SK_RST_REASON_TCP_LISTEN_OVERFLOW,
/* Copy from include/uapi/linux/mptcp.h.
* These reset fields will not be changed since they adhere to
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index a05bb02e204c3..be467a0e13d19 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -689,6 +689,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
bool fastopen, bool *req_stolen,
enum skb_drop_reason *drop_reason)
{
+ enum sk_rst_reason rst_reason = SK_RST_REASON_INVALID_SYN;
struct tcp_options_received tmp_opt;
struct sock *child;
const struct tcphdr *th = tcp_hdr(skb);
@@ -960,6 +961,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
inet_rsk(req)->acked = 1;
return NULL;
}
+ rst_reason = SK_RST_REASON_TCP_LISTEN_OVERFLOW;
embryonic_reset:
if (!(flg & TCP_FLAG_RST)) {
@@ -968,7 +970,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
* avoid becoming vulnerable to outside attack aiming at
* resetting legit local connections.
*/
- req->rsk_ops->send_reset(sk, skb, SK_RST_REASON_INVALID_SYN);
+ req->rsk_ops->send_reset(sk, skb, rst_reason);
} else if (fastopen) { /* received a valid RST pkt */
reqsk_fastopen_remove(sk, req, true);
tcp_reset(sk, skb);
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 10:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 10:00 [PATCH net-next] tcp: rstreason: introduce SK_RST_REASON_TCP_LISTEN_OVERFLOW Jiayuan Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox