[PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"

Matthieu Baerts (NGI0) posted 1 patch 1 week, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20260802-mptcp-squash-sft-recverr-v1-1-df5f5e366e7a@kernel.org
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 28 +++++++++++++++++------
1 file changed, 21 insertions(+), 7 deletions(-)
[PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
Posted by Matthieu Baerts (NGI0) 1 week, 6 days ago
The CI validating the latest sefltests on stable kernels reported an
issue with the MPTCP Sockopt selftest:

  04 Mark v6                                           [ OK ]
  setsockopt recverr on: Operation not supported
  client exited, status=1
  05 SOL_MPTCP sockopt v4                              [FAIL]

That's normal, because this feature is not supported by these kernels.

Skip the new test when the feature is not supported by a kernel, but
keep failing if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set
to 1.

While at it, also set the socket option name in the error message, to
quicker understand it is linked to the IP(V6)_RECVERR option, and not
a "receive error" type.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Cc: David Carlier <devnexen@gmail.com>
---
 tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 28 +++++++++++++++++------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index a51828112c43..d68515b7903b 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -183,6 +183,13 @@ static void xgetaddrinfo(const char *node, const char *service,
 	}
 }
 
+static bool expect_all_features(void)
+{
+	char *env = getenv("SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES");
+
+	return env && strcmp(env, "1") == 0;
+}
+
 static int sock_listen_mptcp(const char * const listenaddr,
 			     const char * const port)
 {
@@ -797,14 +804,21 @@ static void test_ip_recverr_sockopt(int fd)
 	}
 
 	r = setsockopt(fd, level, optname, &one, sizeof(one));
-	if (r)
-		die_perror("setsockopt recverr on");
+	if (r) {
+		/* For older kernels not supporting IP(V6)_RECVERR yet */
+		if (errno == EOPNOTSUPP && !expect_all_features()) {
+			fprintf(stderr, "IP(V6)_RECVERR not supported, SKIP\n");
+			return;
+		}
+
+		die_perror("setsockopt IP(V6)_RECVERR on");
+	}
 
 	r = getsockopt(fd, level, optname, &val, &s);
 	if (r)
-		die_perror("getsockopt recverr on");
+		die_perror("getsockopt IP(V6)_RECVERR on");
 	if (s != sizeof(val) || val != one)
-		xerror("recverr on mismatch val=%d len=%u", val, s);
+		xerror("IP(V6)_RECVERR on mismatch val=%d len=%u", val, s);
 
 	r = recvmsg(fd, &msg, MSG_ERRQUEUE | MSG_DONTWAIT);
 	if (r != -1 || errno != EAGAIN)
@@ -813,15 +827,15 @@ static void test_ip_recverr_sockopt(int fd)
 
 	r = setsockopt(fd, level, optname, &zero, sizeof(zero));
 	if (r)
-		die_perror("setsockopt recverr off");
+		die_perror("setsockopt IP(V6)_RECVERR off");
 
 	val = -1;
 	s = sizeof(val);
 	r = getsockopt(fd, level, optname, &val, &s);
 	if (r)
-		die_perror("getsockopt recverr off");
+		die_perror("getsockopt IP(V6)_RECVERR off");
 	if (s != sizeof(val) || val != zero)
-		xerror("recverr off mismatch val=%d len=%u", val, s);
+		xerror("IP(V6)_RECVERR off mismatch val=%d len=%u", val, s);
 }
 
 static int client(int pipefd)

---
base-commit: 4cc6862c479597e623e4dab36bf9e82fa4289bcd
change-id: 20260802-mptcp-squash-sft-recverr-5e03df173004

Best regards,
--  
Matthieu Baerts (NGI0) <matttbe@kernel.org>
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
Posted by Matthieu Baerts 1 week, 6 days ago
Hello,

On 02/08/2026 19:46, Matthieu Baerts (NGI0) wrote:
> The CI validating the latest sefltests on stable kernels reported an
> issue with the MPTCP Sockopt selftest:
> 
>   04 Mark v6                                           [ OK ]
>   setsockopt recverr on: Operation not supported
>   client exited, status=1
>   05 SOL_MPTCP sockopt v4                              [FAIL]
> 
> That's normal, because this feature is not supported by these kernels.
> 
> Skip the new test when the feature is not supported by a kernel, but
> keep failing if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set
> to 1.
> 
> While at it, also set the socket option name in the error message, to
> quicker understand it is linked to the IP(V6)_RECVERR option, and not
> a "receive error" type.
If there is no objection, I suggest applying the patch in our tree, to
stop the CI to complain. Extra fixes can be added later.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
Posted by David CARLIER 1 week, 6 days ago
Hi,

On Sun, 2 Aug 2026 at 18:51, Matthieu Baerts <matttbe@kernel.org> wrote:
>
> Hello,
>
> On 02/08/2026 19:46, Matthieu Baerts (NGI0) wrote:
> > The CI validating the latest sefltests on stable kernels reported an
> > issue with the MPTCP Sockopt selftest:
> >
> >   04 Mark v6                                           [ OK ]
> >   setsockopt recverr on: Operation not supported
> >   client exited, status=1
> >   05 SOL_MPTCP sockopt v4                              [FAIL]
> >
> > That's normal, because this feature is not supported by these kernels.
> >
> > Skip the new test when the feature is not supported by a kernel, but
> > keep failing if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set
> > to 1.
> >
> > While at it, also set the socket option name in the error message, to
> > quicker understand it is linked to the IP(V6)_RECVERR option, and not
> > a "receive error" type.
> If there is no objection, I suggest applying the patch in our tree, to
> stop the CI to complain. Extra fixes can be added later.

No objections at all !

Cheers
>
> Cheers,
> Matt
> --
> Sponsored by the NGI0 Core fund.
>
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
Posted by Matthieu Baerts 1 week, 6 days ago
Hi David,

On 02/08/2026 19:56, David CARLIER wrote:
> Hi,
> 
> On Sun, 2 Aug 2026 at 18:51, Matthieu Baerts <matttbe@kernel.org> wrote:
>>
>> Hello,
>>
>> On 02/08/2026 19:46, Matthieu Baerts (NGI0) wrote:
>>> The CI validating the latest sefltests on stable kernels reported an
>>> issue with the MPTCP Sockopt selftest:
>>>
>>>   04 Mark v6                                           [ OK ]
>>>   setsockopt recverr on: Operation not supported
>>>   client exited, status=1
>>>   05 SOL_MPTCP sockopt v4                              [FAIL]
>>>
>>> That's normal, because this feature is not supported by these kernels.
>>>
>>> Skip the new test when the feature is not supported by a kernel, but
>>> keep failing if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set
>>> to 1.
>>>
>>> While at it, also set the socket option name in the error message, to
>>> quicker understand it is linked to the IP(V6)_RECVERR option, and not
>>> a "receive error" type.
>> If there is no objection, I suggest applying the patch in our tree, to
>> stop the CI to complain. Extra fixes can be added later.
> 
> No objections at all !

Good, thank you for having checked, just did:

New patches for t/upstream:
- 5fede501cf07: "squashed" in "selftests: mptcp: cover IP_RECVERR
sockopt propagation"
- Results: 4cc6862c4795..39f1e342c901 (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/ff8e53068f03a934be5192cdcad821833c10136a/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
Posted by Matthieu Baerts 1 week, 6 days ago
On 02/08/2026 19:51, Matthieu Baerts wrote:
> Hello,
> 
> On 02/08/2026 19:46, Matthieu Baerts (NGI0) wrote:
>> The CI validating the latest sefltests on stable kernels reported an
>> issue with the MPTCP Sockopt selftest:
>>
>>   04 Mark v6                                           [ OK ]
>>   setsockopt recverr on: Operation not supported
>>   client exited, status=1
>>   05 SOL_MPTCP sockopt v4                              [FAIL]
>>
>> That's normal, because this feature is not supported by these kernels.
>>
>> Skip the new test when the feature is not supported by a kernel, but
>> keep failing if SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set
>> to 1.
>>
>> While at it, also set the socket option name in the error message, to
>> quicker understand it is linked to the IP(V6)_RECVERR option, and not
>> a "receive error" type.
> If there is no objection, I suggest applying the patch in our tree, to
> stop the CI to complain. Extra fixes can be added later.

Just did:

New patches for t/upstream:
- 5fede501cf07: "squashed" in "selftests: mptcp: cover IP_RECVERR
sockopt propagation"
- Results: 4cc6862c4795..39f1e342c901 (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/ff8e53068f03a934be5192cdcad821833c10136a/checks

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