Commit 90c36325 authored by Jason Xing's avatar Jason Xing Committed by David S. Miller
Browse files

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: default avatarJason Xing <kernelxing@tencent.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c14119a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
	FN(TCP_ABORT_ON_DATA)		\
	FN(TCP_TIMEWAIT_SOCKET)		\
	FN(INVALID_SYN)			\
	FN(TCP_ABORT_ON_CLOSE)		\
	FN(MPTCP_RST_EUNSPEC)		\
	FN(MPTCP_RST_EMPTCP)		\
	FN(MPTCP_RST_ERESOURCE)		\
@@ -84,6 +85,11 @@ enum sk_rst_reason {
	 * an error, send a reset"
	 */
	SK_RST_REASON_INVALID_SYN,
	/**
	 * @SK_RST_REASON_TCP_ABORT_ON_CLOSE: abort on close
	 * corresponding to LINUX_MIB_TCPABORTONCLOSE
	 */
	SK_RST_REASON_TCP_ABORT_ON_CLOSE,

	/* Copy from include/uapi/linux/mptcp.h.
	 * These reset fields will not be changed since they adhere to
+1 −1
Original line number Diff line number Diff line
@@ -2833,7 +2833,7 @@ void __tcp_close(struct sock *sk, long timeout)
		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONCLOSE);
		tcp_set_state(sk, TCP_CLOSE);
		tcp_send_active_reset(sk, sk->sk_allocation,
				      SK_RST_REASON_NOT_SPECIFIED);
				      SK_RST_REASON_TCP_ABORT_ON_CLOSE);
	} else if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
		/* Check zero linger _after_ checking for unread data. */
		sk->sk_prot->disconnect(sk, 0);