Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Set CONFIG_PACKET=y for selftests

BPF selftest fails to build with below error:

CLNG-BPF [test_progs] lsm_cgroup.bpf.o
progs/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.

Reported-by: Sachin P Bappalige <sachinpb@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20250707071735.705137-1-skb99@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Saket Kumar Bhaskar and committed by
Alexei Starovoitov
0f626c98 0074250c

+1
+1
tools/testing/selftests/bpf/config
··· 105 105 CONFIG_IP6_NF_IPTABLES=y 106 106 CONFIG_IP6_NF_FILTER=y 107 107 CONFIG_NF_NAT=y 108 + CONFIG_PACKET=y 108 109 CONFIG_RC_CORE=y 109 110 CONFIG_SECURITY=y 110 111 CONFIG_SECURITYFS=y