linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mat Martineau <martineau@kernel.org>
To: Jason Xing <kerneljasonxing@gmail.com>
Cc: edumazet@google.com, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com,  rostedt@goodmis.org,
	kuba@kernel.org, pabeni@redhat.com,  davem@davemloft.net,
	matttbe@kernel.org, geliang@kernel.org,  mptcp@lists.linux.dev,
	netdev@vger.kernel.org,  linux-trace-kernel@vger.kernel.org,
	Jason Xing <kernelxing@tencent.com>
Subject: Re: [PATCH net-next v2 5/6] mptcp: support rstreason for passive reset
Date: Thu, 4 Apr 2024 13:33:00 -0700 (PDT)	[thread overview]
Message-ID: <d8fe5d37-e317-59a5-9a01-d7c6ae43be7b@kernel.org> (raw)
In-Reply-To: <20240404072047.11490-6-kerneljasonxing@gmail.com>

On Thu, 4 Apr 2024, Jason Xing wrote:

> From: Jason Xing <kernelxing@tencent.com>
>
> It relys on what reset options in MPTCP does as rfc8684 says. Reusing
> this logic can save us much energy. This patch replaces all the prior
> NOT_SPECIFIED reasons.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
> net/mptcp/subflow.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index a68d5d0f3e2a..24668d3020aa 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -304,7 +304,10 @@ static struct dst_entry *subflow_v4_route_req(const struct sock *sk,
>
> 	dst_release(dst);
> 	if (!req->syncookie)
> -		tcp_request_sock_ops.send_reset(sk, skb, SK_RST_REASON_NOT_SPECIFIED);
> +		/* According to RFC 8684, 3.2. Starting a New Subflow,
> +		 * we should use an "MPTCP specific error" reason code.
> +		 */
> +		tcp_request_sock_ops.send_reset(sk, skb, SK_RST_REASON_MPTCP_RST_EMPTCP);

Hi Jason -

In this case, the MPTCP reset reason is set in subflow_check_req(). Looks 
like it uses EMPTCP but that isn't guaranteed to stay the same. I think it 
would be better to extract the reset reason from the skb extension or the 
subflow context "reset_reason" field.


> 	return NULL;
> }
>
> @@ -371,7 +374,10 @@ static struct dst_entry *subflow_v6_route_req(const struct sock *sk,
>
> 	dst_release(dst);
> 	if (!req->syncookie)
> -		tcp6_request_sock_ops.send_reset(sk, skb, SK_RST_REASON_NOT_SPECIFIED);
> +		/* According to RFC 8684, 3.2. Starting a New Subflow,
> +		 * we should use an "MPTCP specific error" reason code.
> +		 */
> +		tcp6_request_sock_ops.send_reset(sk, skb, SK_RST_REASON_MPTCP_RST_EMPTCP);

Same issue here.

> 	return NULL;
> }
> #endif
> @@ -778,6 +784,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
> 	bool fallback, fallback_is_fatal;
> 	struct mptcp_sock *owner;
> 	struct sock *child;
> +	int reason;
>
> 	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
>
> @@ -833,7 +840,8 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
> 		 */
> 		if (!ctx || fallback) {
> 			if (fallback_is_fatal) {
> -				subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP);
> +				reason = MPTCP_RST_EMPTCP;
> +				subflow_add_reset_reason(skb, reason);
> 				goto dispose_child;
> 			}
> 			goto fallback;
> @@ -861,7 +869,8 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
> 		} else if (ctx->mp_join) {
> 			owner = subflow_req->msk;
> 			if (!owner) {
> -				subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
> +				reason = MPTCP_RST_EPROHIBIT;
> +				subflow_add_reset_reason(skb, reason);
> 				goto dispose_child;
> 			}
>
> @@ -875,13 +884,18 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
> 					 ntohs(inet_sk((struct sock *)owner)->inet_sport));
> 				if (!mptcp_pm_sport_in_anno_list(owner, sk)) {
> 					SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MISMATCHPORTACKRX);
> +					reason = MPTCP_RST_EUNSPEC;

I think the MPTCP code here should have been using MPTCP_RST_EPROHIBIT.


- Mat

> 					goto dispose_child;
> 				}
> 				SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINPORTACKRX);
> 			}
>
> -			if (!mptcp_finish_join(child))
> +			if (!mptcp_finish_join(child)) {
> +				struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +
> +				reason = subflow->reset_reason;
> 				goto dispose_child;
> +			}
>
> 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
> 			tcp_rsk(req)->drop_req = true;
> @@ -901,7 +915,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
> 	tcp_rsk(req)->drop_req = true;
> 	inet_csk_prepare_for_destroy_sock(child);
> 	tcp_done(child);
> -	req->rsk_ops->send_reset(sk, skb, SK_RST_REASON_NOT_SPECIFIED);
> +	req->rsk_ops->send_reset(sk, skb, convert_mptcp_reason(reason));
>
> 	/* The last child reference will be released by the caller */
> 	return child;
> -- 
> 2.37.3
>
>
>

  reply	other threads:[~2024-04-04 20:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04  7:20 [PATCH net-next 0/6] Implement reset reason mechanism to detect Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 1/6] net: introduce rstreason to detect why the RST is sent Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 2/6] rstreason: prepare for passive reset Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 3/6] rstreason: prepare for active reset Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 4/6] tcp: support rstreason for passive reset Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 5/6] mptcp: " Jason Xing
2024-04-04 20:33   ` Mat Martineau [this message]
2024-04-05  0:12     ` Jason Xing
2024-04-04  7:20 ` [PATCH net-next v2 6/6] rstreason: make it work in trace world Jason Xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8fe5d37-e317-59a5-9a01-d7c6ae43be7b@kernel.org \
    --to=martineau@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geliang@kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kernelxing@tencent.com \
    --cc=kuba@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=matttbe@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).