* [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo
@ 2025-04-09 6:18 Geliang Tang
2025-04-09 7:33 ` MPTCP CI
2025-04-10 17:43 ` Matthieu Baerts
0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2025-04-09 6:18 UTC (permalink / raw)
To: mptcp; +Cc: zhenwei pi, Geliang Tang
From: zhenwei pi <pizhenwei@bytedance.com>
mptcp_connect.c is a startup tutorial of MPTCP programming, however
there is a lack of ai_protocol(IPPROTO_MPTCP) usage. Add comment for
getaddrinfo MPTCP support.
This patch first uses IPPROTO_MPTCP to get addrinfo, and if glibc
version is too old, it falls back to using IPPROTO_TCP.
v2:
- use IPPROTO_MPTCP for getaddrinfo
Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
I verified the correctness of getaddrinfo IPPROTO_MPTCP on Fedora 41
using the following steps:
- Use 'yumdownloader' to download glibc src.rpm and install it.
- Modify glibc.spec and add the patch "getaddrinfo.c: support
MPTCP (BZ #29609)" in it.
- Regenerate the glibc src.rpm package using 'rpm -bs'.
- Use 'mock' to compile a new glibc src.rpm.
- Use 'dnf update' to install the newly compiled glibc.rpm.
- Compile and run mptcp_connect on the the system with new glibc.
---
.../selftests/net/mptcp/mptcp_connect.c | 21 +++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index c83a8b47bbdf..ac1349c4b9e5 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -180,13 +180,26 @@ static void xgetnameinfo(const struct sockaddr *addr, socklen_t addrlen,
}
static void xgetaddrinfo(const char *node, const char *service,
- const struct addrinfo *hints,
+ struct addrinfo *hints,
struct addrinfo **res)
{
+again:
int err = getaddrinfo(node, service, hints, res);
if (err) {
- const char *errstr = getxinfo_strerr(err);
+ const char *errstr;
+
+ /* glibc starts to support MPTCP since v2.42.
+ * For older versions, use IPPROTO_TCP to resolve,
+ * and use TCP/MPTCP to create socket.
+ * Link: https://sourceware.org/git/?p=glibc.git;a=commit;h=a8e9022e0f82
+ */
+ if (err == EAI_SOCKTYPE) {
+ hints->ai_protocol = IPPROTO_TCP;
+ goto again;
+ }
+
+ errstr = getxinfo_strerr(err);
fprintf(stderr, "Fatal: getaddrinfo(%s:%s): %s\n",
node ? node : "", service ? service : "", errstr);
@@ -292,7 +305,7 @@ static int sock_listen_mptcp(const char * const listenaddr,
{
int sock = -1;
struct addrinfo hints = {
- .ai_protocol = IPPROTO_TCP,
+ .ai_protocol = IPPROTO_MPTCP,
.ai_socktype = SOCK_STREAM,
.ai_flags = AI_PASSIVE | AI_NUMERICHOST
};
@@ -356,7 +369,7 @@ static int sock_connect_mptcp(const char * const remoteaddr,
int infd, struct wstate *winfo)
{
struct addrinfo hints = {
- .ai_protocol = IPPROTO_TCP,
+ .ai_protocol = IPPROTO_MPTCP,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *a, *addr;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo
2025-04-09 6:18 [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo Geliang Tang
@ 2025-04-09 7:33 ` MPTCP CI
2025-04-10 17:43 ` Matthieu Baerts
1 sibling, 0 replies; 4+ messages in thread
From: MPTCP CI @ 2025-04-09 7:33 UTC (permalink / raw)
To: zhenwei pi; +Cc: mptcp
Hi zhenwei,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- 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/14350513463
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/1809498f6dbe
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=951400
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo
2025-04-09 6:18 [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo Geliang Tang
2025-04-09 7:33 ` MPTCP CI
@ 2025-04-10 17:43 ` Matthieu Baerts
2025-04-10 17:56 ` Matthieu Baerts
1 sibling, 1 reply; 4+ messages in thread
From: Matthieu Baerts @ 2025-04-10 17:43 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: zhenwei pi
Hi Geliang, zhenwei pi,
On 09/04/2025 08:18, Geliang Tang wrote:
> From: zhenwei pi <pizhenwei@bytedance.com>
>
> mptcp_connect.c is a startup tutorial of MPTCP programming, however
> there is a lack of ai_protocol(IPPROTO_MPTCP) usage. Add comment for
> getaddrinfo MPTCP support.
>
> This patch first uses IPPROTO_MPTCP to get addrinfo, and if glibc
> version is too old, it falls back to using IPPROTO_TCP.
>
> v2:
> - use IPPROTO_MPTCP for getaddrinfo
Thank you for the v2, it looks good to me!
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo
2025-04-10 17:43 ` Matthieu Baerts
@ 2025-04-10 17:56 ` Matthieu Baerts
0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2025-04-10 17:56 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: zhenwei pi
On 10/04/2025 19:43, Matthieu Baerts wrote:
> Hi Geliang, zhenwei pi,
>
> On 09/04/2025 08:18, Geliang Tang wrote:
>> From: zhenwei pi <pizhenwei@bytedance.com>
>>
>> mptcp_connect.c is a startup tutorial of MPTCP programming, however
>> there is a lack of ai_protocol(IPPROTO_MPTCP) usage. Add comment for
>> getaddrinfo MPTCP support.
>>
>> This patch first uses IPPROTO_MPTCP to get addrinfo, and if glibc
>> version is too old, it falls back to using IPPROTO_TCP.
>>
>> v2:
>> - use IPPROTO_MPTCP for getaddrinfo
>
> Thank you for the v2, it looks good to me!
Now in our tree (feat. for -next):
New patches for t/upstream:
- c0ae2744b5e2: selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo
- Results: d16892726caa..24c84d5faab1 (export)
Tests are now in progress:
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/0a21820fc08404b0268c633d793e04f09fa0f72f/checks
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-10 17:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09 6:18 [PATCH mptcp-next v2] selftests: mptcp: use IPPROTO_MPTCP for getaddrinfo Geliang Tang
2025-04-09 7:33 ` MPTCP CI
2025-04-10 17:43 ` Matthieu Baerts
2025-04-10 17:56 ` Matthieu Baerts
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.