All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link
@ 2020-07-28 19:05 Andrii Nakryiko
  2020-07-28 20:07 ` Randy Dunlap
  2020-07-28 22:32 ` Daniel Borkmann
  0 siblings, 2 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2020-07-28 19:05 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel, rdunlap
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

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.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: aa8d3a716b59 ("bpf, xdp: Add bpf_link-based XDP attachment API")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 kernel/bpf/syscall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 0e8c88db7e7a..cd3d599e9e90 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3923,9 +3923,11 @@ static int link_create(union bpf_attr *attr)
 	case BPF_PROG_TYPE_SK_LOOKUP:
 		ret = netns_bpf_link_create(attr, prog);
 		break;
+#ifdef CONFIG_NET
 	case BPF_PROG_TYPE_XDP:
 		ret = bpf_xdp_link_attach(attr, prog);
 		break;
+#endif
 	default:
 		ret = -EINVAL;
 	}
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link
  2020-07-28 19:05 [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link Andrii Nakryiko
@ 2020-07-28 20:07 ` Randy Dunlap
  2020-07-28 20:23   ` Song Liu
  2020-07-28 22:32 ` Daniel Borkmann
  1 sibling, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2020-07-28 20:07 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team

On 7/28/20 12:05 PM, Andrii Nakryiko wrote:
> 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.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: aa8d3a716b59 ("bpf, xdp: Add bpf_link-based XDP attachment API")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  kernel/bpf/syscall.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 0e8c88db7e7a..cd3d599e9e90 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -3923,9 +3923,11 @@ static int link_create(union bpf_attr *attr)
>  	case BPF_PROG_TYPE_SK_LOOKUP:
>  		ret = netns_bpf_link_create(attr, prog);
>  		break;
> +#ifdef CONFIG_NET
>  	case BPF_PROG_TYPE_XDP:
>  		ret = bpf_xdp_link_attach(attr, prog);
>  		break;
> +#endif
>  	default:
>  		ret = -EINVAL;
>  	}
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link
  2020-07-28 20:07 ` Randy Dunlap
@ 2020-07-28 20:23   ` Song Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Song Liu @ 2020-07-28 20:23 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Andrii Nakryiko, bpf, Networking, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Kernel Team

On Tue, Jul 28, 2020 at 1:08 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 7/28/20 12:05 PM, Andrii Nakryiko wrote:
> > 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.
> >
> > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > Fixes: aa8d3a716b59 ("bpf, xdp: Add bpf_link-based XDP attachment API")
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Acked-by: Song Liu <songliubraving@fb.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link
  2020-07-28 19:05 [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link Andrii Nakryiko
  2020-07-28 20:07 ` Randy Dunlap
@ 2020-07-28 22:32 ` Daniel Borkmann
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2020-07-28 22:32 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast, rdunlap; +Cc: andrii.nakryiko, kernel-team

On 7/28/20 9:05 PM, Andrii Nakryiko wrote:
> 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.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Fixes: aa8d3a716b59 ("bpf, xdp: Add bpf_link-based XDP attachment API")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-28 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 19:05 [PATCH bpf-next] bpf: fix build without CONFIG_NET when using BPF XDP link Andrii Nakryiko
2020-07-28 20:07 ` Randy Dunlap
2020-07-28 20:23   ` Song Liu
2020-07-28 22:32 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.