From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Stanislav Fomichev <sdf@google.com>
Cc: Rong Tao <rtoax@foxmail.com>,
ast@kernel.org, Rong Tao <rongtao@cestc.cn>,
kernel test robot <lkp@intel.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
Shuah Khan <shuah@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Daniel Xu <dxu@dxuuu.xyz>,
"open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)"
<bpf@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix error undeclared identifier 'NF_NAT_MANIP_SRC'
Date: Fri, 11 Nov 2022 19:12:30 +0100 [thread overview]
Message-ID: <Y26QjqvVTosoCgPT@lore-desk> (raw)
In-Reply-To: <CAKH8qBvxZBX7_GQYQzSrZ5j=P3rViyqNq3V3oo5CtEMR9BQepA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2855 bytes --]
> On Fri, Nov 11, 2022 at 9:54 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > > On 11/11, Rong Tao wrote:
> > > > From: Rong Tao <rongtao@cestc.cn>
> > >
> > > > commit 472caa69183f("netfilter: nat: un-export nf_nat_used_tuple")
> > > > introduce NF_NAT_MANIP_SRC/DST enum in include/net/netfilter/nf_nat.h,
> > > > and commit b06b45e82b59("selftests/bpf: add tests for bpf_ct_set_nat_info
> > > > kfunc") use NF_NAT_MANIP_SRC/DST in test_bpf_nf.c. We copy enum
> > > > nf_nat_manip_type to test_bpf_nf.c fix this error.
> > >
> > > > How to reproduce the error:
> > >
> > > > $ make -C tools/testing/selftests/bpf/
> > > > ...
> > > > CLNG-BPF [test_maps] test_bpf_nf.bpf.o
> > > > error: use of undeclared identifier 'NF_NAT_MANIP_SRC'
> > > > bpf_ct_set_nat_info(ct, &saddr, sport, NF_NAT_MANIP_SRC);
> > > > ^
> > > > error: use of undeclared identifier 'NF_NAT_MANIP_DST'
> > > > bpf_ct_set_nat_info(ct, &daddr, dport, NF_NAT_MANIP_DST);
> > > > ^
> > > > 2 errors generated.
> > >
> > > $ grep NF_NAT_MANIP_SRC
> > > ./tools/testing/selftests/bpf/tools/include/vmlinux.h
> > > NF_NAT_MANIP_SRC = 0,
> > >
> > > Doesn't look like your kernel config compiles netfilter nat modules?
> >
> > yes, in bpf kself-test config (tools/testing/selftests/bpf/config) nf_nat
> > is compiled as built-in. This issue occurs just if it is compiled as module.
>
> Right, but if we unconditionally define this enum, I think you'll
> break the case where it's compiled as a built-in?
> Since at least in my vmlinux.h I have all the defines and this test
> includes vmlinux.h...
yes, it is correct.
>
> > Regards,
> > Lorenzo
> >
> > >
> > > > Link: https://lore.kernel.org/lkml/202210280447.STsT1gvq-lkp@intel.com/
> > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > Signed-off-by: Rong Tao <rongtao@cestc.cn>
> > > > ---
> > > > tools/testing/selftests/bpf/progs/test_bpf_nf.c | 5 +++++
> > > > 1 file changed, 5 insertions(+)
> > >
> > > > diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> > > > b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> > > > index 227e85e85dda..307ca166ff34 100644
> > > > --- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> > > > +++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
> > > > @@ -3,6 +3,11 @@
> > > > #include <bpf/bpf_helpers.h>
> > > > #include <bpf/bpf_endian.h>
> > >
> > > > +enum nf_nat_manip_type {
> > > > + NF_NAT_MANIP_SRC,
> > > > + NF_NAT_MANIP_DST
> > > > +};
> > > > +
> > > > #define EAFNOSUPPORT 97
> > > > #define EPROTO 71
> > > > #define ENONET 64
> > > > --
> > > > 2.31.1
> > >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-11-11 18:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 3:26 [PATCH bpf-next] selftests/bpf: Fix error undeclared identifier 'NF_NAT_MANIP_SRC' Rong Tao
2022-11-11 17:25 ` sdf
2022-11-11 17:54 ` Lorenzo Bianconi
2022-11-11 18:08 ` Stanislav Fomichev
2022-11-11 18:12 ` Lorenzo Bianconi [this message]
2022-11-11 18:55 ` Stanislav Fomichev
2022-11-11 20:44 ` Andrii Nakryiko
2022-11-17 14:15 ` Rong Tao
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=Y26QjqvVTosoCgPT@lore-desk \
--to=lorenzo@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lkp@intel.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mykolal@fb.com \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/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 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.