Re: Re: [PATCH bpf-next] selftests/bpf: Fix error undeclared identifier 'NF_NAT_MANIP_SRC'

From: Rong Tao
Date: Thu Nov 17 2022 - 09:16:16 EST


First of all, thank you all for your suggestions on this compilation
issue.

> It does break CI ([0]). We could use BPF CO-RE and ___suffix rule to
> avoid this. But we can also say that selftests/bpf/config{,<arch>} has
> to be used by bots that want to build BPF selftests.
>
> [0] https://github.com/kernel-patches/bpf/actions/runs/3446651033/jobs/5752592868

I try to use bpf_core_enum_value_exists() and bpf_core_enum_value(), However,
as far as my knowledge is concerned, I have to redefine a NF_NAT_MANIP_SRC
enumeration, but this would conflict with the situation where there is no
secondary compilation problem. How do I fix this with CO-RE, it seems that
there is no similar CO-RE+ __suffix solution for enumerations in selftests.
Can you give me some tips or help me?