selftests/bpf: Set CONFIG_PACKET=y for selftests
Subsystems (3)
PATCH 1/1 selftests/bpf: Set CONFIG_PACKET=y for selftests
BPF selftest fails to build with below error:
CLNG-BPF [test_progs] lsm_cgroup.bpf.oprogs/lsm_cgroup.c:105:21: error: variable has incomplete type 'struct sockaddr_ll'
105 | struct sockaddr_ll sa = {};
| ^progs/lsm_cgroup.c:105:9: note: forward declaration of 'struct sockaddr_ll'
105 | struct sockaddr_ll sa = {};
| ^
1 error generated.
lsm_cgroup selftest requires sockaddr_ll structure which is not there in vmlinux.h when the kernel is built with CONFIG_PACKET=m.
Enabling CONFIG_PACKET=y ensures that sockaddr_ll is available in vmlinux, allowing it to be captured in the generated vmlinux.h for bpf selftests.
--- tools/testing/selftests/bpf/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/config +1 -0
@@ -105,6 +105,7 @@ CONFIG_IP_NF_IPTABLES=y CONFIG_IP6_NF_IPTABLES=y CONFIG_IP6_NF_FILTER=y CONFIG_NF_NAT=y +CONFIG_PACKET=y CONFIG_RC_CORE=y CONFIG_SECURITY=y CONFIG_SECURITYFS=y
Signature · 1 line
2.43.5
Quoted 11 lines · Saket Kumar Bhaskar
BPF selftest fails to build with below error:
CLNG-BPF [
test_progs] lsm_cgroup.bpf.oprogs/lsm_cgroup.c:105:21: error: variable has incomplete type 'structsockaddr_ll'
105 | structsockaddr_llsa = {};
| ^progs/lsm_cgroup.c:105:9: note: forward declaration of 'structsockaddr_ll'
105 | structsockaddr_llsa = {};
| ^
1 error generated.
Quoted 8 lines
lsm_cgroupselftest requiressockaddr_llstructure which is not there invmlinux.hwhen the kernel is built withCONFIG_PACKET=m.Enabling
CONFIG_PACKET=yensures thatsockaddr_llis available in vmlinux, allowing it to be captured in the generatedvmlinux.hfor bpf selftests.Reported-by Sachin P Bappalige <[email protected]>Signed-off-by Saket Kumar Bhaskar <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 11 lines · On Mon, 7 Jul 2025 12:47:35 +0530 you wrote:
BPF selftest fails to build with below error:
CLNG-BPF [
test_progs] lsm_cgroup.bpf.oprogs/lsm_cgroup.c:105:21: error: variable has incomplete type 'structsockaddr_ll'
105 | structsockaddr_llsa = {};
| ^progs/lsm_cgroup.c:105:9: note: forward declaration of 'structsockaddr_ll'
105 | structsockaddr_llsa = {};
| ^
1 error generated.
Quoted 1 line
[...]
Here is the summary with links:
- selftests/bpf: Set CONFIG_PACKET=y for selftests
https://git.kernel.org/bpf/bpf-next/c/0f626c98fd10
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html