2020-06-30 18:57:59

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH -next] bpf: fix net/core/filter build errors when INET is not enabled

From: Randy Dunlap <[email protected]>

Fix build errors when CONFIG_INET is not set/enabled.

(.text+0x2b1b): undefined reference to `tcp_prot'
(.text+0x2b3b): undefined reference to `tcp_prot'

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Yonghong Song <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: KP Singh <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
net/core/filter.c | 4 ++++
1 file changed, 4 insertions(+)

--- linux-next-20200630.orig/net/core/filter.c
+++ linux-next-20200630/net/core/filter.c
@@ -9328,8 +9328,10 @@ const struct bpf_func_proto bpf_skc_to_t

BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)
{
+#ifdef CONFIG_INET
if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
return (unsigned long)sk;
+#endif

#if IS_BUILTIN(CONFIG_IPV6)
if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
@@ -9350,8 +9352,10 @@ const struct bpf_func_proto bpf_skc_to_t

BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
{
+#ifdef CONFIG_INET
if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)
return (unsigned long)sk;
+#endif

#if IS_BUILTIN(CONFIG_IPV6)
if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)


2020-06-30 19:10:31

by Yonghong Song

[permalink] [raw]
Subject: Re: [PATCH -next] bpf: fix net/core/filter build errors when INET is not enabled



On 6/30/20 10:29 AM, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
> Fix build errors when CONFIG_INET is not set/enabled.
>
> (.text+0x2b1b): undefined reference to `tcp_prot'
> (.text+0x2b3b): undefined reference to `tcp_prot'
>
> Signed-off-by: Randy Dunlap <[email protected]>
> Cc: Alexei Starovoitov <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> Cc: Martin KaFai Lau <[email protected]>
> Cc: Song Liu <[email protected]>
> Cc: Yonghong Song <[email protected]>
> Cc: Andrii Nakryiko <[email protected]>
> Cc: John Fastabend <[email protected]>
> Cc: KP Singh <[email protected]>
> Cc: [email protected]
> Cc: [email protected]

Thanks for the fix!

Acked-by: Yonghong Song <[email protected]>

2020-07-01 15:41:06

by Alexei Starovoitov

[permalink] [raw]
Subject: Re: [PATCH -next] bpf: fix net/core/filter build errors when INET is not enabled

On Tue, Jun 30, 2020 at 10:50 AM Yonghong Song <[email protected]> wrote:
>
>
>
> On 6/30/20 10:29 AM, Randy Dunlap wrote:
> > From: Randy Dunlap <[email protected]>
> >
> > Fix build errors when CONFIG_INET is not set/enabled.
> >
> > (.text+0x2b1b): undefined reference to `tcp_prot'
> > (.text+0x2b3b): undefined reference to `tcp_prot'
> >
> > Signed-off-by: Randy Dunlap <[email protected]>
> > Cc: Alexei Starovoitov <[email protected]>
> > Cc: Daniel Borkmann <[email protected]>
> > Cc: Martin KaFai Lau <[email protected]>
> > Cc: Song Liu <[email protected]>
> > Cc: Yonghong Song <[email protected]>
> > Cc: Andrii Nakryiko <[email protected]>
> > Cc: John Fastabend <[email protected]>
> > Cc: KP Singh <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
>
> Thanks for the fix!
>
> Acked-by: Yonghong Song <[email protected]>

Applied. Thanks