[PATCH mptcp-next] Squash to "selftests: mptcp: cover IP_RECVERR sockopt propagation"
"Matthieu Baerts (NGI0)" <[email protected]> Sun, 02 Aug 2026 19:46:16 +0200
| Newsgroups | dev.linux.lists.mptcp |
|---|---|
| Message-ID | <[email protected]> |
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) <[email protected]> --- Cc: David Carlier <[email protected]> --- 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) <[email protected]>