Skip to content

Commit 0bc1f77

Browse files
committed
tcp: rstreason: handle timewait cases in the receive path
JIRA: https://issues.redhat.com/browse/RHEL-48648 Upstream Status: linux.git commit 22a3255 Author: Jason Xing <kernelxing@tencent.com> Date: Fri May 10 20:25:01 2024 +0800 tcp: rstreason: handle timewait cases in the receive path There are two possible cases where TCP layer can send an RST. Since they happen in the same place, I think using one independent reason is enough to identify this special situation. Signed-off-by: Jason Xing <kernelxing@tencent.com> Link: https://lore.kernel.org/r/20240510122502.27850-5-kerneljasonxing@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent 2da51d3 commit 0bc1f77

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

include/net/rstreason.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
FN(TCP_FLAGS) \
1616
FN(TCP_OLD_ACK) \
1717
FN(TCP_ABORT_ON_DATA) \
18+
FN(TCP_TIMEWAIT_SOCKET) \
1819
FN(MPTCP_RST_EUNSPEC) \
1920
FN(MPTCP_RST_EMPTCP) \
2021
FN(MPTCP_RST_ERESOURCE) \
@@ -72,6 +73,10 @@ enum sk_rst_reason {
7273
*/
7374
SK_RST_REASON_TCP_ABORT_ON_DATA,
7475

76+
/* Here start with the independent reasons */
77+
/** @SK_RST_REASON_TCP_TIMEWAIT_SOCKET: happen on the timewait socket */
78+
SK_RST_REASON_TCP_TIMEWAIT_SOCKET,
79+
7580
/* Copy from include/uapi/linux/mptcp.h.
7681
* These reset fields will not be changed since they adhere to
7782
* RFC 8684. So do not touch them. I'm going to list each definition

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
21602160
tcp_v4_timewait_ack(sk, skb);
21612161
break;
21622162
case TCP_TW_RST:
2163-
tcp_v4_send_reset(sk, skb, sk_rst_convert_drop_reason(drop_reason));
2163+
tcp_v4_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET);
21642164
inet_twsk_deschedule_put(inet_twsk(sk));
21652165
goto discard_it;
21662166
case TCP_TW_SUCCESS:;

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
18211821
tcp_v6_timewait_ack(sk, skb);
18221822
break;
18231823
case TCP_TW_RST:
1824-
tcp_v6_send_reset(sk, skb, sk_rst_convert_drop_reason(drop_reason));
1824+
tcp_v6_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET);
18251825
inet_twsk_deschedule_put(inet_twsk(sk));
18261826
goto discard_it;
18271827
case TCP_TW_SUCCESS:

0 commit comments

Comments
 (0)