Skip to content

Commit 289cc4c

Browse files
committed
mptcp: introducing a helper into active reset logic
JIRA: https://issues.redhat.com/browse/RHEL-48648 Upstream Status: linux.git Conflicts:\ - Context difference due to missing upstream commit d5dfbfa ("mptcp: drop duplicate header inclusions") in c9s. commit 215d402 Author: Jason Xing <kernelxing@tencent.com> Date: Thu Apr 25 11:13:39 2024 +0800 mptcp: introducing a helper into active reset logic Since we have mapped every mptcp reset reason definition in enum sk_rst_reason, introducing a new helper can cover some missing places where we have already set the subflow->reset_reason. Note: using SK_RST_REASON_NOT_SPECIFIED is the same as SK_RST_REASON_MPTCP_RST_EUNSPEC. They are both unknown. So we can convert it directly. Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Jason Xing <kernelxing@tencent.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent ce222ff commit 289cc4c

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

net/mptcp/protocol.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#endif
2323
#include <net/mptcp.h>
2424
#include <net/xfrm.h>
25-
#include <net/rstreason.h>
2625
#include <asm/ioctls.h>
2726
#include "protocol.h"
2827
#include "mib.h"
@@ -2567,8 +2566,7 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk)
25672566

25682567
slow = lock_sock_fast(tcp_sk);
25692568
if (tcp_sk->sk_state != TCP_CLOSE) {
2570-
tcp_send_active_reset(tcp_sk, GFP_ATOMIC,
2571-
SK_RST_REASON_NOT_SPECIFIED);
2569+
mptcp_send_active_reset_reason(tcp_sk);
25722570
tcp_set_state(tcp_sk, TCP_CLOSE);
25732571
}
25742572
unlock_sock_fast(tcp_sk, slow);

net/mptcp/protocol.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <net/inet_connection_sock.h>
1313
#include <uapi/linux/mptcp.h>
1414
#include <net/genetlink.h>
15+
#include <net/rstreason.h>
1516

1617
#include "mptcp_pm_gen.h"
1718

@@ -603,6 +604,16 @@ sk_rst_convert_mptcp_reason(u32 reason)
603604
}
604605
}
605606

607+
static inline void
608+
mptcp_send_active_reset_reason(struct sock *sk)
609+
{
610+
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
611+
enum sk_rst_reason reason;
612+
613+
reason = sk_rst_convert_mptcp_reason(subflow->reset_reason);
614+
tcp_send_active_reset(sk, GFP_ATOMIC, reason);
615+
}
616+
606617
static inline u64
607618
mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow)
608619
{

net/mptcp/subflow.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#endif
2323
#include <net/mptcp.h>
2424
#include <uapi/linux/mptcp.h>
25-
#include <net/rstreason.h>
2625

2726
#include "protocol.h"
2827
#include "mib.h"
@@ -419,7 +418,7 @@ void mptcp_subflow_reset(struct sock *ssk)
419418
/* must hold: tcp_done() could drop last reference on parent */
420419
sock_hold(sk);
421420

422-
tcp_send_active_reset(ssk, GFP_ATOMIC, SK_RST_REASON_NOT_SPECIFIED);
421+
mptcp_send_active_reset_reason(ssk);
423422
tcp_done(ssk);
424423
if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &mptcp_sk(sk)->flags))
425424
mptcp_schedule_work(sk);
@@ -1352,8 +1351,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
13521351
tcp_set_state(ssk, TCP_CLOSE);
13531352
while ((skb = skb_peek(&ssk->sk_receive_queue)))
13541353
sk_eat_skb(ssk, skb);
1355-
tcp_send_active_reset(ssk, GFP_ATOMIC,
1356-
SK_RST_REASON_NOT_SPECIFIED);
1354+
mptcp_send_active_reset_reason(ssk);
13571355
WRITE_ONCE(subflow->data_avail, false);
13581356
return false;
13591357
}

0 commit comments

Comments
 (0)