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

bpf: fix link failure with NETFILTER=y INET=n

Explicitly check if NETFILTER_BPF_LINK is enabled, else configs
that have NETFILTER=y but CONFIG_INET=n fail to link:

> kernel/bpf/syscall.o: undefined reference to `netfilter_prog_ops'
> kernel/bpf/verifier.o: undefined reference to `netfilter_verifier_ops'

Fixes: fd9c663b9ad6 ("bpf: minimal support for programs hooked into netfilter framework")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304220903.fRZTJtxe-lkp@intel.com/
Signed-off-by: Florian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/20230422073544.17634-1-fw@strlen.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Florian Westphal and committed by
Alexei Starovoitov
6d26d985 fbc1449d

+1 -1
+1 -1
include/linux/bpf_types.h
··· 79 79 #endif 80 80 BPF_PROG_TYPE(BPF_PROG_TYPE_SYSCALL, bpf_syscall, 81 81 void *, void *) 82 - #ifdef CONFIG_NETFILTER 82 + #ifdef CONFIG_NETFILTER_BPF_LINK 83 83 BPF_PROG_TYPE(BPF_PROG_TYPE_NETFILTER, netfilter, 84 84 struct bpf_nf_ctx, struct bpf_nf_ctx) 85 85 #endif