[PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc

Geliang Tang posted 1 patch 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/092fc76415deb1b45da5bb691ef6069fbab7dd09.1758591744.git.tanggeliang@kylinos.cn
tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Geliang Tang 1 month, 3 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Compiling pm_nl_ctl on older versions of glibc will report the following
errors:

'''
  CC       pm_nl_ctl
pm_nl_ctl.c: In function 'capture_events':
pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0' undeclared (first use in this function)
  204 |                                         if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pm_nl_ctl.c:204:53: note: each undeclared identifier is reported only once for each function it appears in
pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE' undeclared (first use in this function); did you mean 'MPTCP_ATTR_SERVER_SIDE'?
  206 |                                         if (flags & MPTCP_PM_EV_FLAG_SERVER_SIDE)
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                     MPTCP_ATTR_SERVER_SIDE
'''

To fix this, this patch redefines MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 and
MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.

Fixes: 24733e193a0d ("selftests: mptcp: userspace pm: validate deny-join-id0 flag")
Fixes: 198c12e28b51 ("selftests: mptcp: pm: get server-side flag")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
index d4981b76693b..409af973d2ef 100644
--- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
+++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c
@@ -23,6 +23,12 @@
 #ifndef IPPROTO_MPTCP
 #define IPPROTO_MPTCP 262
 #endif
+#ifndef MPTCP_PM_EV_FLAG_DENY_JOIN_ID0
+#define MPTCP_PM_EV_FLAG_DENY_JOIN_ID0	(1 << 0)
+#endif
+#ifndef MPTCP_PM_EV_FLAG_SERVER_SIDE
+#define MPTCP_PM_EV_FLAG_SERVER_SIDE	(1 << 1)
+#endif
 
 static void syntax(char *argv[])
 {
-- 
2.48.1
Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Matthieu Baerts 1 month, 3 weeks ago
Hi Geliang,

On 23/09/2025 02:42, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Compiling pm_nl_ctl on older versions of glibc will report the following
> errors:
> 
> '''
>   CC       pm_nl_ctl
> pm_nl_ctl.c: In function 'capture_events':
> pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0' undeclared (first use in this function)
>   204 |                                         if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
>       |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> pm_nl_ctl.c:204:53: note: each undeclared identifier is reported only once for each function it appears in
> pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE' undeclared (first use in this function); did you mean 'MPTCP_ATTR_SERVER_SIDE'?
>   206 |                                         if (flags & MPTCP_PM_EV_FLAG_SERVER_SIDE)
>       |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       |                                                     MPTCP_ATTR_SERVER_SIDE
> '''
> 
> To fix this, this patch redefines MPTCP_PM_EV_FLAG_DENY_JOIN_ID0 and
> MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.

You shouldn't get this error, because this file is supposed to be
compiled from the kernel source directory, or at least using the kernel
headers built from there

How do you compile this file? Are you not using the Makefile in the same
folder? Or do you have a separate build dir and you didn't specify
KHDR_INCLUDES?

  make headers_install INSTALL_HDR_PATH="${HEADERS}"
  make KHDR_INCLUDES="-I${HEADERS}/include" \
       -C tools/testing/selftests/net/mptcp

Or use the kselftests scripts:

  make -C tools/testing/selftests TARGETS=net/mptcp install \
       INSTALL_PATH=${INSTALL}
  cd ${INSTALL}
  ./run_kselftest.sh -c net/mptcp


Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Geliang Tang 1 month, 3 weeks ago
Hi Matt,

On Tue, 2025-09-23 at 08:53 +0100, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 23/09/2025 02:42, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > Compiling pm_nl_ctl on older versions of glibc will report the
> > following
> > errors:
> > 
> > '''
> >   CC       pm_nl_ctl
> > pm_nl_ctl.c: In function 'capture_events':
> > pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0'
> > undeclared (first use in this function)
> >   204 |                                         if (flags &
> > MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
> >       |                                                    
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > pm_nl_ctl.c:204:53: note: each undeclared identifier is reported
> > only once for each function it appears in
> > pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE'
> > undeclared (first use in this function); did you mean
> > 'MPTCP_ATTR_SERVER_SIDE'?
> >   206 |                                         if (flags &
> > MPTCP_PM_EV_FLAG_SERVER_SIDE)
> >       |                                                    
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >       |                                                    
> > MPTCP_ATTR_SERVER_SIDE
> > '''
> > 
> > To fix this, this patch redefines MPTCP_PM_EV_FLAG_DENY_JOIN_ID0
> > and
> > MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.
> 
> You shouldn't get this error, because this file is supposed to be
> compiled from the kernel source directory, or at least using the
> kernel
> headers built from there
> 
> How do you compile this file? Are you not using the Makefile in the

I got these errors when compiling the bpf selftests with the commit
"selftests/bpf: Add mptcp pm_nl_ctl link" using mptcp-upstream-virtme-
docker:

https://patchwork.kernel.org/project/mptcp/patch/8cdb0df7316a6baa93df88b0fe78aaa710f3bb72.1738924354.git.tanggeliang@kylinos.cn/

Thanks,
-Geliang

> same
> folder? Or do you have a separate build dir and you didn't specify
> KHDR_INCLUDES?
> 
>   make headers_install INSTALL_HDR_PATH="${HEADERS}"
>   make KHDR_INCLUDES="-I${HEADERS}/include" \
>        -C tools/testing/selftests/net/mptcp
> 
> Or use the kselftests scripts:
> 
>   make -C tools/testing/selftests TARGETS=net/mptcp install \
>        INSTALL_PATH=${INSTALL}
>   cd ${INSTALL}
>   ./run_kselftest.sh -c net/mptcp
> 
> 
> Cheers,
> Matt
Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Matthieu Baerts 1 month, 3 weeks ago
Hi Geliang,

On 23/09/2025 09:03, Geliang Tang wrote:
> Hi Matt,
> 
> On Tue, 2025-09-23 at 08:53 +0100, Matthieu Baerts wrote:
>> Hi Geliang,
>>
>> On 23/09/2025 02:42, Geliang Tang wrote:
>>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>>
>>> Compiling pm_nl_ctl on older versions of glibc will report the
>>> following
>>> errors:
>>>
>>> '''
>>>   CC       pm_nl_ctl
>>> pm_nl_ctl.c: In function 'capture_events':
>>> pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0'
>>> undeclared (first use in this function)
>>>   204 |                                         if (flags &
>>> MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
>>>       |                                                    
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> pm_nl_ctl.c:204:53: note: each undeclared identifier is reported
>>> only once for each function it appears in
>>> pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE'
>>> undeclared (first use in this function); did you mean
>>> 'MPTCP_ATTR_SERVER_SIDE'?
>>>   206 |                                         if (flags &
>>> MPTCP_PM_EV_FLAG_SERVER_SIDE)
>>>       |                                                    
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>       |                                                    
>>> MPTCP_ATTR_SERVER_SIDE
>>> '''
>>>
>>> To fix this, this patch redefines MPTCP_PM_EV_FLAG_DENY_JOIN_ID0
>>> and
>>> MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.
>>
>> You shouldn't get this error, because this file is supposed to be
>> compiled from the kernel source directory, or at least using the
>> kernel
>> headers built from there
>>
>> How do you compile this file? Are you not using the Makefile in the
> 
> I got these errors when compiling the bpf selftests with the commit
> "selftests/bpf: Add mptcp pm_nl_ctl link" using mptcp-upstream-virtme-
> docker:
> 
> https://patchwork.kernel.org/project/mptcp/patch/8cdb0df7316a6baa93df88b0fe78aaa710f3bb72.1738924354.git.tanggeliang@kylinos.cn/

Mmh, we already had this issue with pm_nl_ctl in BPF selftests in the
past, and Alexei didn't want to support KHDR_INCLUDES, because these
selftests are not "proper" KSelftests :-/

Did you not add "pm_nl_ctl" because the BPF CI was using a tool old
version of IPRoute? They updated it. So maybe we don't need this patch
anymore?

> 
> Thanks,
> -Geliang
> 
>> same
>> folder? Or do you have a separate build dir and you didn't specify
>> KHDR_INCLUDES?
>>
>>   make headers_install INSTALL_HDR_PATH="${HEADERS}"
>>   make KHDR_INCLUDES="-I${HEADERS}/include" \
>>        -C tools/testing/selftests/net/mptcp
>>
>> Or use the kselftests scripts:
>>
>>   make -C tools/testing/selftests TARGETS=net/mptcp install \
>>        INSTALL_PATH=${INSTALL}
>>   cd ${INSTALL}
>>   ./run_kselftest.sh -c net/mptcp
>>
>>
>> Cheers,
>> Matt

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

Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Matthieu Baerts 1 month ago
Hi Geliang,

On 23/09/2025 10:16, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 23/09/2025 09:03, Geliang Tang wrote:
>> Hi Matt,
>>
>> On Tue, 2025-09-23 at 08:53 +0100, Matthieu Baerts wrote:
>>> Hi Geliang,
>>>
>>> On 23/09/2025 02:42, Geliang Tang wrote:
>>>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>>>
>>>> Compiling pm_nl_ctl on older versions of glibc will report the
>>>> following
>>>> errors:
>>>>
>>>> '''
>>>>   CC       pm_nl_ctl
>>>> pm_nl_ctl.c: In function 'capture_events':
>>>> pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0'
>>>> undeclared (first use in this function)
>>>>   204 |                                         if (flags &
>>>> MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
>>>>       |                                                    
>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> pm_nl_ctl.c:204:53: note: each undeclared identifier is reported
>>>> only once for each function it appears in
>>>> pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE'
>>>> undeclared (first use in this function); did you mean
>>>> 'MPTCP_ATTR_SERVER_SIDE'?
>>>>   206 |                                         if (flags &
>>>> MPTCP_PM_EV_FLAG_SERVER_SIDE)
>>>>       |                                                    
>>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>       |                                                    
>>>> MPTCP_ATTR_SERVER_SIDE
>>>> '''
>>>>
>>>> To fix this, this patch redefines MPTCP_PM_EV_FLAG_DENY_JOIN_ID0
>>>> and
>>>> MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.
>>>
>>> You shouldn't get this error, because this file is supposed to be
>>> compiled from the kernel source directory, or at least using the
>>> kernel
>>> headers built from there
>>>
>>> How do you compile this file? Are you not using the Makefile in the
>>
>> I got these errors when compiling the bpf selftests with the commit
>> "selftests/bpf: Add mptcp pm_nl_ctl link" using mptcp-upstream-virtme-
>> docker:
>>
>> https://patchwork.kernel.org/project/mptcp/patch/8cdb0df7316a6baa93df88b0fe78aaa710f3bb72.1738924354.git.tanggeliang@kylinos.cn/
> 
> Mmh, we already had this issue with pm_nl_ctl in BPF selftests in the
> past, and Alexei didn't want to support KHDR_INCLUDES, because these
> selftests are not "proper" KSelftests :-/
> 
> Did you not add "pm_nl_ctl" because the BPF CI was using a tool old
> version of IPRoute? They updated it. So maybe we don't need this patch
> anymore?

If we can use 'ip' instead of 'pm_nl_ctl', we can drop this patch from
Patchwork. Can we do that?

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

Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by Geliang Tang 1 month ago
Hi Matt,

On Thu, 2025-10-09 at 16:30 +0200, Matthieu Baerts wrote:
> Hi Geliang,
> 
> On 23/09/2025 10:16, Matthieu Baerts wrote:
> > Hi Geliang,
> > 
> > On 23/09/2025 09:03, Geliang Tang wrote:
> > > Hi Matt,
> > > 
> > > On Tue, 2025-09-23 at 08:53 +0100, Matthieu Baerts wrote:
> > > > Hi Geliang,
> > > > 
> > > > On 23/09/2025 02:42, Geliang Tang wrote:
> > > > > From: Geliang Tang <tanggeliang@kylinos.cn>
> > > > > 
> > > > > Compiling pm_nl_ctl on older versions of glibc will report
> > > > > the
> > > > > following
> > > > > errors:
> > > > > 
> > > > > '''
> > > > >   CC       pm_nl_ctl
> > > > > pm_nl_ctl.c: In function 'capture_events':
> > > > > pm_nl_ctl.c:204:53: error: 'MPTCP_PM_EV_FLAG_DENY_JOIN_ID0'
> > > > > undeclared (first use in this function)
> > > > >   204 |                                         if (flags &
> > > > > MPTCP_PM_EV_FLAG_DENY_JOIN_ID0)
> > > > >       |                                                    
> > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > pm_nl_ctl.c:204:53: note: each undeclared identifier is
> > > > > reported
> > > > > only once for each function it appears in
> > > > > pm_nl_ctl.c:206:53: error: 'MPTCP_PM_EV_FLAG_SERVER_SIDE'
> > > > > undeclared (first use in this function); did you mean
> > > > > 'MPTCP_ATTR_SERVER_SIDE'?
> > > > >   206 |                                         if (flags &
> > > > > MPTCP_PM_EV_FLAG_SERVER_SIDE)
> > > > >       |                                                    
> > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > >       |                                                    
> > > > > MPTCP_ATTR_SERVER_SIDE
> > > > > '''
> > > > > 
> > > > > To fix this, this patch redefines
> > > > > MPTCP_PM_EV_FLAG_DENY_JOIN_ID0
> > > > > and
> > > > > MPTCP_PM_EV_FLAG_SERVER_SIDE in pm_nl_ctl.c.
> > > > 
> > > > You shouldn't get this error, because this file is supposed to
> > > > be
> > > > compiled from the kernel source directory, or at least using
> > > > the
> > > > kernel
> > > > headers built from there
> > > > 
> > > > How do you compile this file? Are you not using the Makefile in
> > > > the
> > > 
> > > I got these errors when compiling the bpf selftests with the
> > > commit
> > > "selftests/bpf: Add mptcp pm_nl_ctl link" using mptcp-upstream-
> > > virtme-
> > > docker:
> > > 
> > > https://patchwork.kernel.org/project/mptcp/patch/8cdb0df7316a6baa93df88b0fe78aaa710f3bb72.1738924354.git.tanggeliang@kylinos.cn/
> > 
> > Mmh, we already had this issue with pm_nl_ctl in BPF selftests in
> > the
> > past, and Alexei didn't want to support KHDR_INCLUDES, because
> > these
> > selftests are not "proper" KSelftests :-/
> > 
> > Did you not add "pm_nl_ctl" because the BPF CI was using a tool old
> > version of IPRoute? They updated it. So maybe we don't need this
> > patch
> > anymore?
> 
> If we can use 'ip' instead of 'pm_nl_ctl', we can drop this patch
> from
> Patchwork. Can we do that?

Currently, 'ip' cannot fully replace 'pm_nl_ctl'. For example, MPTCP
userspace pm commands such as "ann" and "csf" are not yet supported
through 'ip mptcp'. Therefore, when adding MPTCP bpf userspace pm tests
to BPF selftests in the future, 'pm_nl_ctl' will still need to be used.

I agree to drop this patch for now. We can add it back when 'pm_nl_ctl'
is needed in bpf selftests in the future.

I changed the state of this patch as 'Rejected' on Pathwork.

Thanks,
-Geliang

> 
> Cheers,
> Matt

Re: [PATCH mptcp-next] selftests: mptcp: pm: fix pm_nl_ctl build errors with old glibc
Posted by MPTCP CI 1 month, 3 weeks ago
Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Critical: 83 Call Trace(s) - Critical: Global Timeout ❌
- 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/17933660640

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


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)