Skip to content

Commit 90c3632

Browse files
JasonXingdavem330
authored andcommitted
tcp: rstreason: introduce SK_RST_REASON_TCP_ABORT_ON_CLOSE for active reset
Introducing a new type TCP_ABORT_ON_CLOSE for tcp reset reason to handle the case where more data is unread in closing phase. Signed-off-by: Jason Xing <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2c14119 commit 90c3632

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
@@ -17,6 +17,7 @@
1717
FN(TCP_ABORT_ON_DATA) \
1818
FN(TCP_TIMEWAIT_SOCKET) \
1919
FN(INVALID_SYN) \
20+
FN(TCP_ABORT_ON_CLOSE) \
2021
FN(MPTCP_RST_EUNSPEC) \
2122
FN(MPTCP_RST_EMPTCP) \
2223
FN(MPTCP_RST_ERESOURCE) \
@@ -84,6 +85,11 @@ enum sk_rst_reason {
8485
* an error, send a reset"
8586
*/
8687
SK_RST_REASON_INVALID_SYN,
88+
/**
89+
* @SK_RST_REASON_TCP_ABORT_ON_CLOSE: abort on close
90+
* corresponding to LINUX_MIB_TCPABORTONCLOSE
91+
*/
92+
SK_RST_REASON_TCP_ABORT_ON_CLOSE,
8793

8894
/* Copy from include/uapi/linux/mptcp.h.
8995
* 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
@@ -2833,7 +2833,7 @@ void __tcp_close(struct sock *sk, long timeout)
28332833
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONCLOSE);
28342834
tcp_set_state(sk, TCP_CLOSE);
28352835
tcp_send_active_reset(sk, sk->sk_allocation,
2836-
SK_RST_REASON_NOT_SPECIFIED);
2836+
SK_RST_REASON_TCP_ABORT_ON_CLOSE);
28372837
} else if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
28382838
/* Check zero linger _after_ checking for unread data. */
28392839
sk->sk_prot->disconnect(sk, 0);

0 commit comments

Comments
 (0)