* [PATCH net 1/2] selftests: netfilter: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS Matthieu Baerts (NGI0)
@ 2026-09-04 16:13 ` Matthieu Baerts (NGI0)
2026-09-04 16:41 ` Ilya Maximets
2026-09-04 16:13 ` [PATCH net 2/2] selftests: forwarding: " Matthieu Baerts (NGI0)
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-09-04 16:13 UTC (permalink / raw)
To: Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel, Matthieu Baerts (NGI0)
KHDR_INCLUDES is typically used to include headers from the kernel
source directory instead of only relying on the ones from the host: they
can be missing or outdated.
The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a
target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
$(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
was built in a different build directory.
Other net targets have KHDR_INCLUDES added to their CFLAGS.
Fixes: 3f189349e52a ("selftests: netfilter: move to net subdir")
Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/testing/selftests/net/netfilter/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/netfilter/Makefile b/tools/testing/selftests/net/netfilter/Makefile
index f88dd4ef8d26..df3c20c90f5d 100644
--- a/tools/testing/selftests/net/netfilter/Makefile
+++ b/tools/testing/selftests/net/netfilter/Makefile
@@ -2,6 +2,8 @@
top_srcdir = ../../../../..
+CFLAGS += $(KHDR_INCLUDES)
+
HOSTPKG_CONFIG := pkg-config
MNL_CFLAGS := $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
MNL_LDLIBS := $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
--
2.55.0
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH net 1/2] selftests: netfilter: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 ` [PATCH net 1/2] selftests: netfilter: " Matthieu Baerts (NGI0)
@ 2026-09-04 16:41 ` Ilya Maximets
2026-09-04 16:55 ` Matthieu Baerts
0 siblings, 1 reply; 10+ messages in thread
From: Ilya Maximets @ 2026-09-04 16:41 UTC (permalink / raw)
To: Matthieu Baerts (NGI0),
Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel
On 9/4/26 6:13 PM, Matthieu Baerts (NGI0) wrote:
> KHDR_INCLUDES is typically used to include headers from the kernel
> source directory instead of only relying on the ones from the host: they
> can be missing or outdated.
>
> The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a
> target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
> $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
> was built in a different build directory.
>
> Other net targets have KHDR_INCLUDES added to their CFLAGS.
>
> Fixes: 3f189349e52a ("selftests: netfilter: move to net subdir")
I think, this should point to a commit that added the first C test:
Fixes: a64d558d8cf9 ("selftests: netfilter: add nfqueue test case")
> Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> tools/testing/selftests/net/netfilter/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/net/netfilter/Makefile b/tools/testing/selftests/net/netfilter/Makefile
> index f88dd4ef8d26..df3c20c90f5d 100644
> --- a/tools/testing/selftests/net/netfilter/Makefile
> +++ b/tools/testing/selftests/net/netfilter/Makefile
> @@ -2,6 +2,8 @@
>
> top_srcdir = ../../../../..
>
> +CFLAGS += $(KHDR_INCLUDES)
> +
> HOSTPKG_CONFIG := pkg-config
> MNL_CFLAGS := $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
> MNL_LDLIBS := $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
>
This solves my problem with building netfilter tests locally with uAPI
modifications. Beside the Fixes tag, LGTM.
Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH net 1/2] selftests: netfilter: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:41 ` Ilya Maximets
@ 2026-09-04 16:55 ` Matthieu Baerts
0 siblings, 0 replies; 10+ messages in thread
From: Matthieu Baerts @ 2026-09-04 16:55 UTC (permalink / raw)
To: Ilya Maximets, Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Cc: netfilter-devel, coreteam, netdev, linux-kselftest, linux-kernel
Hi Ilya,
On 04/09/2026 18:41, Ilya Maximets wrote:
> On 9/4/26 6:13 PM, Matthieu Baerts (NGI0) wrote:
>> KHDR_INCLUDES is typically used to include headers from the kernel
>> source directory instead of only relying on the ones from the host: they
>> can be missing or outdated.
>>
>> The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a
>> target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
>> $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
>> was built in a different build directory.
>>
>> Other net targets have KHDR_INCLUDES added to their CFLAGS.
>>
>> Fixes: 3f189349e52a ("selftests: netfilter: move to net subdir")
>
> I think, this should point to a commit that added the first C test:
>
> Fixes: a64d558d8cf9 ("selftests: netfilter: add nfqueue test case")
Good catch! I saw that CFLAGS was set before, but indeed, KHDR_INCLUDES
wasn't.
If we want to change the Fixes tag, we will also need to add:
Fixes: a52540522c95 ("selftests/landlock: Fix out-of-tree builds")
Which is when KHDR_INCLUDES got introduced. (Or it is enough with the
current Fixes tag, as long as it is included in the last stable version:
that's probably enough for CIs using kselftests from the last stable
version on older ones.)
@Net maintainers: please tell me if I need to change the Fixes tag in a v2.
>> Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
>> tools/testing/selftests/net/netfilter/Makefile | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/testing/selftests/net/netfilter/Makefile b/tools/testing/selftests/net/netfilter/Makefile
>> index f88dd4ef8d26..df3c20c90f5d 100644
>> --- a/tools/testing/selftests/net/netfilter/Makefile
>> +++ b/tools/testing/selftests/net/netfilter/Makefile
>> @@ -2,6 +2,8 @@
>>
>> top_srcdir = ../../../../..
>>
>> +CFLAGS += $(KHDR_INCLUDES)
>> +
>> HOSTPKG_CONFIG := pkg-config
>> MNL_CFLAGS := $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
>> MNL_LDLIBS := $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
>>
>
> This solves my problem with building netfilter tests locally with uAPI
> modifications. Beside the Fixes tag, LGTM.
Thank you for having checked!
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net 2/2] selftests: forwarding: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS Matthieu Baerts (NGI0)
2026-09-04 16:13 ` [PATCH net 1/2] selftests: netfilter: " Matthieu Baerts (NGI0)
@ 2026-09-04 16:13 ` Matthieu Baerts (NGI0)
2026-09-04 16:44 ` Ilya Maximets
2026-09-04 18:20 ` [PATCH net 0/2] selftests: net: " Matthieu Baerts
2026-09-09 21:00 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-09-04 16:13 UTC (permalink / raw)
To: Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel, Matthieu Baerts (NGI0)
KHDR_INCLUDES is typically used to include headers from the kernel
source directory instead of only relying on the ones from the host: they
can be missing or outdated.
The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a
target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
$(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
was built in a different build directory.
Other net targets have KHDR_INCLUDES added to their CFLAGS.
Fixes: 05068eaa67b2 ("selftest: net: Add basic functionality tests for ipmr.")
Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/testing/selftests/net/forwarding/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile
index bbaf4d937dd8..1bdfd141c0fb 100644
--- a/tools/testing/selftests/net/forwarding/Makefile
+++ b/tools/testing/selftests/net/forwarding/Makefile
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+ OR MIT
+CFLAGS += $(KHDR_INCLUDES)
+
TEST_PROGS := \
bridge_activity_notify.sh \
bridge_fdb_learning_limit.sh \
--
2.55.0
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH net 2/2] selftests: forwarding: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 ` [PATCH net 2/2] selftests: forwarding: " Matthieu Baerts (NGI0)
@ 2026-09-04 16:44 ` Ilya Maximets
0 siblings, 0 replies; 10+ messages in thread
From: Ilya Maximets @ 2026-09-04 16:44 UTC (permalink / raw)
To: Matthieu Baerts (NGI0),
Pablo Neira Ayuso, Florian Westphal, Phil Sutter,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel
On 9/4/26 6:13 PM, Matthieu Baerts (NGI0) wrote:
> KHDR_INCLUDES is typically used to include headers from the kernel
> source directory instead of only relying on the ones from the host: they
> can be missing or outdated.
>
> The kselftest doc recommends assigning KHDR_INCLUDES to CFLAGS in a
> target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
> $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
> was built in a different build directory.
>
> Other net targets have KHDR_INCLUDES added to their CFLAGS.
>
> Fixes: 05068eaa67b2 ("selftest: net: Add basic functionality tests for ipmr.")
> Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> tools/testing/selftests/net/forwarding/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile
> index bbaf4d937dd8..1bdfd141c0fb 100644
> --- a/tools/testing/selftests/net/forwarding/Makefile
> +++ b/tools/testing/selftests/net/forwarding/Makefile
> @@ -1,5 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0+ OR MIT
>
> +CFLAGS += $(KHDR_INCLUDES)
> +
> TEST_PROGS := \
> bridge_activity_notify.sh \
> bridge_fdb_learning_limit.sh \
>
Reviewed-by: Ilya Maximets <i.maximets@ovn.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS Matthieu Baerts (NGI0)
2026-09-04 16:13 ` [PATCH net 1/2] selftests: netfilter: " Matthieu Baerts (NGI0)
2026-09-04 16:13 ` [PATCH net 2/2] selftests: forwarding: " Matthieu Baerts (NGI0)
@ 2026-09-04 18:20 ` Matthieu Baerts
2026-09-04 18:51 ` Jakub Kicinski
2026-09-09 21:00 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 10+ messages in thread
From: Matthieu Baerts @ 2026-09-04 18:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel, Pablo Neira Ayuso,
Florian Westphal, Phil Sutter, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Hi Jakub,
On 04/09/2026 18:13, Matthieu Baerts (NGI0) wrote:
> KHDR_INCLUDES is typically used to include headers from the kernel
> source directory instead of only relying on the ones from the host: they
> can be missing or outdated. See the issue reported in [1] where users
> have to set USERCFLAGS instead, which shouldn't be needed.
>
> The kselftest doc [2] recommends assigning KHDR_INCLUDES to CFLAGS in a
> target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
> $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
> was built in a different build directory.
>
> Other net targets have KHDR_INCLUDES added to their CFLAGS.
These patches didn't get picked up in the tests because the Clang build
failed with Rust code:
https://netdev-ctrl.bots.linux.dev/logs/build/1158213/14791779/build_clang/stderr
I only modified the selftests here. Other patches sent before me have
the same issue, but some sent after don't. One of those "random" issues
on the build server?
Cheers,
Matt
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS
2026-09-04 18:20 ` [PATCH net 0/2] selftests: net: " Matthieu Baerts
@ 2026-09-04 18:51 ` Jakub Kicinski
2026-09-08 15:28 ` Matthieu Baerts
0 siblings, 1 reply; 10+ messages in thread
From: Jakub Kicinski @ 2026-09-04 18:51 UTC (permalink / raw)
To: Matthieu Baerts
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel, Pablo Neira Ayuso,
Florian Westphal, Phil Sutter, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
On Fri, 4 Sep 2026 20:20:44 +0200 Matthieu Baerts wrote:
> These patches didn't get picked up in the tests because the Clang build
> failed with Rust code:
>
> https://netdev-ctrl.bots.linux.dev/logs/build/1158213/14791779/build_clang/stderr
>
> I only modified the selftests here. Other patches sent before me have
> the same issue, but some sent after don't. One of those "random" issues
> on the build server?
kbuild / tools build likes to sometimes pick up the wrong source tree
if you have a worktree nested inside a git repo :/
Here the Rust build was partially using the sources from the main repo
and partially from the work tree.
I'll push a NIPA workaround to sync the main repo to something recent
it should paper over this bug. It's not the first time it happened.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS
2026-09-04 18:51 ` Jakub Kicinski
@ 2026-09-08 15:28 ` Matthieu Baerts
0 siblings, 0 replies; 10+ messages in thread
From: Matthieu Baerts @ 2026-09-08 15:28 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Ilya Maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel, Pablo Neira Ayuso,
Florian Westphal, Phil Sutter, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Shuah Khan, David Ahern, Ido Schimmel
Hi Jakub,
On 04/09/2026 20:51, Jakub Kicinski wrote:
> On Fri, 4 Sep 2026 20:20:44 +0200 Matthieu Baerts wrote:
>> These patches didn't get picked up in the tests because the Clang build
>> failed with Rust code:
>>
>> https://netdev-ctrl.bots.linux.dev/logs/build/1158213/14791779/build_clang/stderr
>>
>> I only modified the selftests here. Other patches sent before me have
>> the same issue, but some sent after don't. One of those "random" issues
>> on the build server?
>
> kbuild / tools build likes to sometimes pick up the wrong source tree
> if you have a worktree nested inside a git repo :/
> Here the Rust build was partially using the sources from the main repo
> and partially from the work tree.
> I'll push a NIPA workaround to sync the main repo to something recent
> it should paper over this bug. It's not the first time it happened.
Thank you for the explanation, and for the fix!
I was checking if I had to resend this series for the CI, but it looks
like these patches have been taken by the "brancher" service, e.g.
- https://github.com/linux-netdev/testing/commit/93408c0627c0
- https://github.com/linux-netdev/testing/commit/82fe019a07b0
Maybe they are there after the few hickups due to PW's update?
(It is not clear why it says there is a conflict, but I guess that's
because the contest job didn't override the status for the same reasons.)
Anyway, no need to re-send them then. Or should I?
Cheers,
Matt
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS
2026-09-04 16:13 [PATCH net 0/2] selftests: net: use KHDR_INCLUDES in CFLAGS Matthieu Baerts (NGI0)
` (2 preceding siblings ...)
2026-09-04 18:20 ` [PATCH net 0/2] selftests: net: " Matthieu Baerts
@ 2026-09-09 21:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-09 21:00 UTC (permalink / raw)
To: Matthieu Baerts
Cc: pablo, fw, phil, davem, edumazet, kuba, pabeni, horms, shuah,
dsahern, idosch, i.maximets, netfilter-devel, coreteam, netdev,
linux-kselftest, linux-kernel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 04 Sep 2026 18:13:01 +0200 you wrote:
> KHDR_INCLUDES is typically used to include headers from the kernel
> source directory instead of only relying on the ones from the host: they
> can be missing or outdated. See the issue reported in [1] where users
> have to set USERCFLAGS instead, which shouldn't be needed.
>
> The kselftest doc [2] recommends assigning KHDR_INCLUDES to CFLAGS in a
> target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
> $(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
> was built in a different build directory.
>
> [...]
Here is the summary with links:
- [net,1/2] selftests: netfilter: use KHDR_INCLUDES in CFLAGS
https://git.kernel.org/netdev/net-next/c/9a5d20a88afb
- [net,2/2] selftests: forwarding: use KHDR_INCLUDES in CFLAGS
https://git.kernel.org/netdev/net-next/c/f1f4394a8bb4
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread