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

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: 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 90c36325
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
	FN(TCP_TIMEWAIT_SOCKET)		\
	FN(INVALID_SYN)			\
	FN(TCP_ABORT_ON_CLOSE)		\
	FN(TCP_ABORT_ON_LINGER)		\
	FN(MPTCP_RST_EUNSPEC)		\
	FN(MPTCP_RST_EMPTCP)		\
	FN(MPTCP_RST_ERESOURCE)		\
@@ -90,6 +91,11 @@ enum sk_rst_reason {
	 * corresponding to LINUX_MIB_TCPABORTONCLOSE
	 */
	SK_RST_REASON_TCP_ABORT_ON_CLOSE,
	/**
	 * @SK_RST_REASON_TCP_ABORT_ON_LINGER: abort on linger
	 * corresponding to LINUX_MIB_TCPABORTONLINGER
	 */
	SK_RST_REASON_TCP_ABORT_ON_LINGER,

	/* 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
@@ -2908,7 +2908,7 @@ void __tcp_close(struct sock *sk, long timeout)
		if (READ_ONCE(tp->linger2) < 0) {
			tcp_set_state(sk, TCP_CLOSE);
			tcp_send_active_reset(sk, GFP_ATOMIC,
					      SK_RST_REASON_NOT_SPECIFIED);
					      SK_RST_REASON_TCP_ABORT_ON_LINGER);
			__NET_INC_STATS(sock_net(sk),
					LINUX_MIB_TCPABORTONLINGER);
		} else {