]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tcp: rstreason: introduce SK_RST_REASON_TCP_KEEPALIVE_TIMEOUT for active reset
authorJason Xing <kernelxing@tencent.com>
Fri, 2 Aug 2024 10:21:10 +0000 (18:21 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Aug 2024 09:24:45 +0000 (10:24 +0100)
Introducing this to show the users the reason of keepalive timeout.

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/rstreason.h
net/ipv4/tcp_timer.c

index bbf20d0bbde703af8c6c3ad79bccb7a0f9c50253..9c0c46df0e73335eeb781903ee8e7c06b38ef85e 100644 (file)
@@ -21,6 +21,7 @@
        FN(TCP_ABORT_ON_LINGER)         \
        FN(TCP_ABORT_ON_MEMORY)         \
        FN(TCP_STATE)                   \
+       FN(TCP_KEEPALIVE_TIMEOUT)       \
        FN(MPTCP_RST_EUNSPEC)           \
        FN(MPTCP_RST_EMPTCP)            \
        FN(MPTCP_RST_ERESOURCE)         \
@@ -108,6 +109,12 @@ enum sk_rst_reason {
         * Please see RFC 9293 for all possible reset conditions
         */
        SK_RST_REASON_TCP_STATE,
+       /**
+        * @SK_RST_REASON_TCP_KEEPALIVE_TIMEOUT: time to timeout
+        * When we have already run out of all the chances, which means
+        * keepalive timeout, we have to reset the connection
+        */
+       SK_RST_REASON_TCP_KEEPALIVE_TIMEOUT,
 
        /* Copy from include/uapi/linux/mptcp.h.
         * These reset fields will not be changed since they adhere to
index 3910f6d8614eec16784bab5530fd7b09136b6c7a..86169127e4d1fe0e00c660b7ea718db5253a14e5 100644 (file)
@@ -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_KEEPALIVE_TIMEOUT);
                        tcp_write_err(sk);
                        goto out;
                }