[PATCH mptcp-net] mptcp: sockopt: set sockopt on all subflows

Matthieu Baerts (NGI0) posted 1 patch 1 week, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20260527-mptcp-sockopt-all-sf-no-break-v1-1-4318be7b1e22@kernel.org
net/mptcp/sockopt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
[PATCH mptcp-net] mptcp: sockopt: set sockopt on all subflows
Posted by Matthieu Baerts (NGI0) 1 week, 5 days ago
The mptcp_setsockopt_all_sf(), currently used only with TCP_MAXSEG,
stopped when one subflow returned an error.

Even if it is not wrong, this is different from the other helpers trying
to set the option on all subflows, and then returning an error if at
least one of them had an issue.

Follow this behaviour, for a question of uniformity.

Fixes: 51c5fd09e1b4 ("mptcp: add TCP_MAXSEG sockopt support")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/sockopt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index 87b5796d0135..bc2cded00187 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -813,10 +813,11 @@ static int mptcp_setsockopt_all_sf(struct mptcp_sock *msk, int level,
 
 	mptcp_for_each_subflow(msk, subflow) {
 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+		int err;
 
-		ret = tcp_setsockopt(ssk, level, optname, optval, optlen);
-		if (ret)
-			break;
+		err = tcp_setsockopt(ssk, level, optname, optval, optlen);
+		if (err < 0 && ret == 0)
+			ret = err;
 	}
 
 	if (!ret)

---
base-commit: 19d4169d06892e0c451ec370292ec71fa6bd8028
change-id: 20260527-mptcp-sockopt-all-sf-no-break-ad14ff690358

Best regards,
--  
Matthieu Baerts (NGI0) <matttbe@kernel.org>
Re: [PATCH mptcp-net] mptcp: sockopt: set sockopt on all subflows
Posted by Mat Martineau 1 week, 3 days ago
On Wed, 27 May 2026, Matthieu Baerts (NGI0) wrote:

> The mptcp_setsockopt_all_sf(), currently used only with TCP_MAXSEG,
> stopped when one subflow returned an error.
>
> Even if it is not wrong, this is different from the other helpers trying
> to set the option on all subflows, and then returning an error if at
> least one of them had an issue.
>
> Follow this behaviour, for a question of uniformity.
>
> Fixes: 51c5fd09e1b4 ("mptcp: add TCP_MAXSEG sockopt support")
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> net/mptcp/sockopt.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index 87b5796d0135..bc2cded00187 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
> @@ -813,10 +813,11 @@ static int mptcp_setsockopt_all_sf(struct mptcp_sock *msk, int level,
>
> 	mptcp_for_each_subflow(msk, subflow) {
> 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> +		int err;
>
> -		ret = tcp_setsockopt(ssk, level, optname, optval, optlen);
> -		if (ret)
> -			break;
> +		err = tcp_setsockopt(ssk, level, optname, optval, optlen);
> +		if (err < 0 && ret == 0)
> +			ret = err;
> 	}
>
> 	if (!ret)
>
> ---
> base-commit: 19d4169d06892e0c451ec370292ec71fa6bd8028
> change-id: 20260527-mptcp-sockopt-all-sf-no-break-ad14ff690358

Thanks for the fix, good idea to stay consistent here.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Re: [PATCH mptcp-net] mptcp: sockopt: set sockopt on all subflows
Posted by MPTCP CI 1 week, 5 days ago
Hi Matthieu,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Unstable: 1 failed test(s): selftest_mptcp_join ⚠️ 
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/26494709412

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/48cb8fdb0919
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1101402


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)