bpf: Only provide bpf_sock_from_file with CONFIG_NET
authorFlorent Revest <revest@chromium.org>
Tue, 8 Dec 2020 17:36:23 +0000 (18:36 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 9 Dec 2020 02:23:36 +0000 (18:23 -0800)
commitb60da4955f53d1f50e44351a9c3a37a92503079e
tree35605a7a6667b10c8dc1354aa76751d4f63f9126
parent8bdd8e275ede9786d845b3ec952836e61fd824e9
bpf: Only provide bpf_sock_from_file with CONFIG_NET

This moves the bpf_sock_from_file definition into net/core/filter.c
which only gets compiled with CONFIG_NET and also moves the helper proto
usage next to other tracing helpers that are conditional on CONFIG_NET.

This avoids
  ld: kernel/trace/bpf_trace.o: in function `bpf_sock_from_file':
  bpf_trace.c:(.text+0xe23): undefined reference to `sock_from_file'
When compiling a kernel with BPF and without NET.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Florent Revest <revest@chromium.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20201208173623.1136863-1-revest@chromium.org
include/linux/bpf.h
kernel/trace/bpf_trace.c
net/core/filter.c