MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v22 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow
Date: Fri, 06 Nov 2026 11:51:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-201363@kernel.org> (raw)
In-Reply-To: <db502fd327a473221aef9a5bf2995cf627ec187f.1793964796.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests: mptcp: wait_for_remote_key() fails on TCP and
  fallback sockets
- [Low] selftests: mptcp: missing SOL_MPTCP fallback macro in
  mptcp_connect.c
--

commit 4c8b1264330b7ada03e819d1d1820de00d3fda02
Author: Geliang Tang <geliang@kernel.org>

selftests: mptcp: connect: check TFO SIOCINQ overflow

This commit adds a check in mptcp_connect's server loop to wait for the
remote key on MPTFO connections and verify that SIOCINQ does not return
INT_MAX.

> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 178d98d91fea2..41eff818e950e 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c

[ ... ]

> @@ -1176,6 +1177,24 @@ static void maybe_close(int fd)
>  		close(fd);
>  }
>  
> +static bool wait_for_remote_key(int fd)
> +{
> +	struct mptcp_info info;
> +	int retries = 10;
> +	socklen_t olen;
> +
> +	while (retries > 0) {
> +		olen = sizeof(info);
> +		if (getsockopt(fd, SOL_MPTCP, MPTCP_INFO, &info, &olen) < 0)

[Severity: Low]
Does SOL_MPTCP need a fallback definition in mptcp_connect.c?  SOL_MPTCP is
not defined in the UAPI headers, so building against older libc headers
(prior to glibc 2.34) will fail with an undeclared identifier error unless
it is guarded with #ifndef SOL_MPTCP like IPPROTO_MPTCP and TCP_ULP at the
top of this file (and SOL_MPTCP in mptcp_inq.c and mptcp_sockopt.c).

> +			return false;
> +		if (info.mptcpi_flags & MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED)
> +			return true;
> +		usleep(10000);
> +		retries--;
> +	}
> +	return false;
> +}
> +
>  int main_loop_s(int listensock)
>  {
>  	struct sockaddr_storage ss;
> @@ -1207,6 +1226,24 @@ int main_loop_s(int listensock)
>  		check_sockaddr(pf, &ss, salen);
>  		check_getpeername(remotesock, &ss, salen);
>  
> +		if (cfg_sockopt_types.mptfo) {
> +			int avail;
> +
> +			if (!wait_for_remote_key(remotesock)) {
> +				fprintf(stderr,
> +					"TFO: timeout waiting for third ACK\n");
> +				close(remotesock);
> +				return 1;
> +			}

[Severity: Low]
Will wait_for_remote_key() fail when remotesock is a plain TCP socket or an
MPTCP socket that fell back to TCP?

In mptcp_connect.sh, run_tests_mptfo() passes "-o MPTFO" to run_tests_lo(),
which also runs MPTCP->TCP, TCP->MPTCP, and TCP->TCP transfers when invoked
with -t:

tools/testing/selftests/net/mptcp/mptcp_connect.sh:run_tests_lo() {
    ...
	do_transfer ${listener_ns} ${connector_ns} MPTCP TCP \
		    ${connect_addr} ${local_addr} "${extra_args}"
    ...
	do_transfer ${listener_ns} ${connector_ns} TCP MPTCP \
		    ${connect_addr} ${local_addr} "${extra_args}"
    ...
}

On a TCP listener (-s TCP) or an MPTCP listener accepting a connection from
a TCP client, getsockopt(fd, SOL_MPTCP, MPTCP_INFO, ...) fails immediately
with ENOPROTOOPT, causing wait_for_remote_key() to return false and abort
the test with "TFO: timeout waiting for third ACK".

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1793964796.git.tanggeliang@kylinos.cn?part=2

  reply	other threads:[~2026-11-06 11:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 11:36 [PATCH mptcp-next v22 0/8] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-11-06 11:36 ` [PATCH mptcp-net v22 1/8] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-06 11:36 ` [PATCH mptcp-next v22 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-06 11:51   ` sashiko-bot [this message]
2026-11-06 11:36 ` [PATCH mptcp-net v22 3/8] mptcp: fix fallback dummy mapping anchor Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 4/8] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 5/8] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 6/8] mptcp: remove CB offset field Geliang Tang
2026-11-06 12:12   ` sashiko-bot
2026-11-06 11:37 ` [PATCH mptcp-next v22 7/8] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-11-06 12:04   ` sashiko-bot
2026-11-06 11:37 ` [PATCH mptcp-next v22 8/8] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-11-06 13:59 ` [PATCH mptcp-next v22 0/8] Reduce the differences between TCP and MPTCP for TLS usage MPTCP CI

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=sashiko-outbox-201363@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@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