Netdev List
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Ilya Maximets <i.maximets@ovn.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] selftests: netfilter: use KHDR_INCLUDES in CFLAGS
Date: Fri, 4 Sep 2026 18:55:43 +0200	[thread overview]
Message-ID: <3ce5323e-18a5-41d0-860b-588b79074589@kernel.org> (raw)
In-Reply-To: <5d871ca2-1db4-47b8-bd48-34b3fa42961e@ovn.org>

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.


  reply	other threads:[~2026-09-04 16:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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:41   ` Ilya Maximets
2026-09-04 16:55     ` Matthieu Baerts [this message]
2026-09-04 16:13 ` [PATCH net 2/2] selftests: forwarding: " 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-04 18:51   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ce5323e-18a5-41d0-860b-588b79074589@kernel.org \
    --to=matttbe@kernel.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox