MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <martineau@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 3/3] mptcp: blackhole only if 1st SYN retrans w/o MPC is accepted
Date: Thu, 16 Jan 2025 16:26:51 -0800 (PST)	[thread overview]
Message-ID: <91ff8079-cb49-0b23-57bd-c18f6dc1ff87@kernel.org> (raw)
In-Reply-To: <20250114-mpc-no-blackhole-v1-3-994bd2a357fb@kernel.org>

On Tue, 14 Jan 2025, Matthieu Baerts (NGI0) wrote:

> The Fixes commit mentioned this:
>
>> An MPTCP firewall blackhole can be detected if the following SYN
>> retransmission after a fallback to "plain" TCP is accepted.
>
> But in fact, this blackhole was detected if any following SYN
> retransmissions after a fallback to TCP was accepted.
>
> That's because 'mptcp_subflow_early_fallback()' will set 'request_mptcp'
> to 0, and 'mpc_drop' will never be reset to 0 after.
>
> This is an issue, because some not so unusual situations might cause the
> kernel to detect a false-positive blackhole, e.g. a client trying to
> connect to a server while the network is not ready yet, causing a few
> SYN retransmissions, before reaching the end server.
>
> Fixes: 27069e7cb3d1 ("mptcp: disable active MPTCP in case of blackhole")
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> net/mptcp/ctrl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index 3999e0ba2c35b50c36ce32277e0b8bfb24197946..2dd81e6c26bdb5220abed68e26d70d2dc3ab14fb 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c

Some more context before the diff hunk:

> 	if (subflow->request_mptcp && ssk->sk_state == TCP_SYN_SENT) {
> 		struct net *net = sock_net(ssk);
> 		u8 timeouts, to_max;
>
> 		timeouts = inet_csk(ssk)->icsk_retransmits;
> 		to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback;
>
> 		if (timeouts == to_max || (timeouts < to_max && expired)) {

I think it would help to change the above code to:

> 	if (ssk->sk_state == TCP_SYN_SENT) {
> 		struct net *net = sock_net(ssk);
> 		u8 timeouts, to_max;
>
>		if (!subflow->request_mptcp) {
> 			subflow->mptcp_drop = 0;
> 			return;
> 		}
>
> 		timeouts = inet_csk(ssk)->icsk_retransmits;
> 		to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback;
>
> 		if (timeouts == to_max || (timeouts < to_max && expired)) {

(end of added hunk)

> @@ -418,9 +418,9 @@ void mptcp_active_detect_blackhole(struct sock *ssk, bool expired)
> 			MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP);
> 			subflow->mpc_drop = 1;
> 			mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow);
> -		} else {
> -			subflow->mpc_drop = 0;
> 		}

And drop this from the patch:

> +	} else if (ssk->sk_state == TCP_SYN_SENT) {
> +		subflow->mpc_drop = 0;

That way ssk->sk_state is only checked once.

- Mat

  reply	other threads:[~2025-01-17  0:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 17:37 [PATCH mptcp-next 0/3] mptcp: blackhole: sysctl SYN retrans + fix conditions Matthieu Baerts (NGI0)
2025-01-14 17:37 ` [PATCH mptcp-next 1/3] doc: mptcp: sysctl: blackhole_timeout is per-netns Matthieu Baerts (NGI0)
2025-01-14 17:37 ` [PATCH mptcp-next 2/3] mptcp: sysctl: add syn_retrans_before_tcp_fallback Matthieu Baerts (NGI0)
2025-01-14 17:37 ` [PATCH mptcp-next 3/3] mptcp: blackhole only if 1st SYN retrans w/o MPC is accepted Matthieu Baerts (NGI0)
2025-01-17  0:26   ` Mat Martineau [this message]
2025-01-17 15:10     ` Matthieu Baerts
2025-01-21 22:36       ` Mat Martineau
2025-01-22 11:41         ` Matthieu Baerts
2025-01-14 18:50 ` [PATCH mptcp-next 0/3] mptcp: blackhole: sysctl SYN retrans + fix conditions MPTCP CI
2025-01-17  0:13 ` Mat Martineau
2025-01-17 14:33   ` Matthieu Baerts

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=91ff8079-cb49-0b23-57bd-c18f6dc1ff87@kernel.org \
    --to=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /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