Skip to content

Commit edc92b4

Browse files
JasonXingdavem330
authored andcommitted
tcp: rstreason: introduce SK_RST_REASON_TCP_ABORT_ON_LINGER for active reset
Introducing a new type TCP_ABORT_ON_LINGER for tcp reset reason to handle negative linger value case. Signed-off-by: Jason Xing <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 90c3632 commit edc92b4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/net/rstreason.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
FN(TCP_TIMEWAIT_SOCKET) \
1919
FN(INVALID_SYN) \
2020
FN(TCP_ABORT_ON_CLOSE) \
21+
FN(TCP_ABORT_ON_LINGER) \
2122
FN(MPTCP_RST_EUNSPEC) \
2223
FN(MPTCP_RST_EMPTCP) \
2324
FN(MPTCP_RST_ERESOURCE) \
@@ -90,6 +91,11 @@ enum sk_rst_reason {
9091
* corresponding to LINUX_MIB_TCPABORTONCLOSE
9192
*/
9293
SK_RST_REASON_TCP_ABORT_ON_CLOSE,
94+
/**
95+
* @SK_RST_REASON_TCP_ABORT_ON_LINGER: abort on linger
96+
* corresponding to LINUX_MIB_TCPABORTONLINGER
97+
*/
98+
SK_RST_REASON_TCP_ABORT_ON_LINGER,
9399

94100
/* Copy from include/uapi/linux/mptcp.h.
95101
* These reset fields will not be changed since they adhere to

net/ipv4/tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2908,7 +2908,7 @@ void __tcp_close(struct sock *sk, long timeout)
29082908
if (READ_ONCE(tp->linger2) < 0) {
29092909
tcp_set_state(sk, TCP_CLOSE);
29102910
tcp_send_active_reset(sk, GFP_ATOMIC,
2911-
SK_RST_REASON_NOT_SPECIFIED);
2911+
SK_RST_REASON_TCP_ABORT_ON_LINGER);
29122912
__NET_INC_STATS(sock_net(sk),
29132913
LINUX_MIB_TCPABORTONLINGER);
29142914
} else {

0 commit comments

Comments
 (0)