Skip to content

Commit 310ad79

Browse files
anakryikoborkmann
authored andcommitted
bpf: Fix build without CONFIG_NET when using BPF XDP link
Entire net/core subsystem is not built without CONFIG_NET. linux/netdevice.h just assumes that it's always there, so the easiest way to fix this is to conditionally compile out bpf_xdp_link_attach() use in bpf/syscall.c. Fixes: aa8d3a7 ("bpf, xdp: Add bpf_link-based XDP attachment API") Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20200728190527.110830-1-andriin@fb.com
1 parent ca5cd35 commit 310ad79

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎kernel/bpf/syscall.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3923,9 +3923,11 @@ static int link_create(union bpf_attr *attr)
39233923
case BPF_PROG_TYPE_SK_LOOKUP:
39243924
ret = netns_bpf_link_create(attr, prog);
39253925
break;
3926+
#ifdef CONFIG_NET
39263927
case BPF_PROG_TYPE_XDP:
39273928
ret = bpf_xdp_link_attach(attr, prog);
39283929
break;
3930+
#endif
39293931
default:
39303932
ret = -EINVAL;
39313933
}

0 commit comments

Comments
 (0)