MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Cong Liu <liucong2@kylinos.cn>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH v2] selftests: mptcp: Fix incorrect file descriptor check in main_loop
Date: Thu, 16 Jan 2025 17:29:22 +0100	[thread overview]
Message-ID: <b5a01f30-3e9d-4ae7-97d1-0efec4e87ed1@kernel.org> (raw)
In-Reply-To: <20250116085459.31419-1-liucong2@kylinos.cn>

Hi Cong Liu,

(-Cc everybody, except the MPTCP ML)

Thank you for the v2.

On 16/01/2025 09:54, Cong Liu wrote:
> Fix a bug where the code was checking the wrong file descriptor
> when opening the input file. The code was checking 'fd' instead
> of 'fd_in', which could lead to incorrect error handling.
> 
> Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")

I think the first issue has been introduced in 05be5e273c84 ("selftests:
mptcp: add disconnect tests"), then in the one you mentioned. Because it
is just in the selftests, feel free to add the older one, or both.

> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
> ---
>  tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 4209b9569039..31f4c5618569 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -1249,7 +1249,7 @@ int main_loop(void)
>  
>  	if (cfg_input && cfg_sockopt_types.mptfo) {
>  		fd_in = open(cfg_input, O_RDONLY);
> -		if (fd < 0)
> +		if (fd_in < 0)
>  			xerror("can't open %s:%d", cfg_input, errno);
>  	}
>  
> @@ -1272,7 +1272,7 @@ int main_loop(void)
>  
>  	if (cfg_input && !cfg_sockopt_types.mptfo) {
>  		fd_in = open(cfg_input, O_RDONLY);
> -		if (fd < 0)
> +		if (fd_in < 0)
>  			xerror("can't open %s:%d", cfg_input, errno);
>  	}

The CI is not able to apply your patch. On which base are you?
Do you mind using our 'export' branch from our GitHub repository?

> When I tried to solve the problem where fd_in was closed in the again
> code block but not reopened in certain scenarios, I encountered some 
> issues. Here's my code, but it causes the disconnect test to fail and I'm
> not sure how to fix this. 

Some fixes have been recently applied around the 'disconnect' tests,
maybe this issue has already been fixed?

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


      reply	other threads:[~2025-01-16 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  8:52 [PATCH 0/3] selftests: mptcp: Fix various issues in main_loop Cong Liu
2025-01-13  8:52 ` [PATCH 1/3] selftests: mptcp: Fix incorrect file descriptor check " Cong Liu
2025-01-13  8:52 ` [PATCH 2/3] selftests: mptcp: Fix input fd lifecycle in reconnection loop Cong Liu
2025-01-15  1:06   ` Geliang Tang
2025-01-13  8:52 ` [PATCH 3/3] selftests: mptcp: Clean up resources properly in main_loop Cong Liu
2025-01-15  1:13   ` Geliang Tang
2025-01-13 16:39 ` [PATCH 0/3] selftests: mptcp: Fix various issues " MPTCP CI
2025-01-13 16:50 ` MPTCP CI
2025-01-14 18:16 ` Matthieu Baerts
2025-01-16  8:54   ` [PATCH v2] selftests: mptcp: Fix incorrect file descriptor check " Cong Liu
2025-01-16 16:29     ` Matthieu Baerts [this message]

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=b5a01f30-3e9d-4ae7-97d1-0efec4e87ed1@kernel.org \
    --to=matttbe@kernel.org \
    --cc=liucong2@kylinos.cn \
    --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