* [PATCHv2 bpf-next] bpf: fix building without CONFIG_INET
@ 2018-10-08 18:30 Joe Stringer
2018-10-08 20:52 ` Song Liu
0 siblings, 1 reply; 3+ messages in thread
From: Joe Stringer @ 2018-10-08 18:30 UTC (permalink / raw)
To: daniel
Cc: Arnd Bergmann, ast, davem, john.fastabend, kafai,
makita.toshiaki, brakmo, rdna, brouer, jakub.kicinski,
m.xhonneux, dsahern, netdev, linux-kernel, liu.song.a23
From: Arnd Bergmann <arnd@arndb.de>
The newly added TCP and UDP handling fails to link when CONFIG_INET
is disabled:
net/core/filter.o: In function `sk_lookup':
filter.c:(.text+0x7ff8): undefined reference to `tcp_hashinfo'
filter.c:(.text+0x7ffc): undefined reference to `tcp_hashinfo'
filter.c:(.text+0x8020): undefined reference to `__inet_lookup_established'
filter.c:(.text+0x8058): undefined reference to `__inet_lookup_listener'
filter.c:(.text+0x8068): undefined reference to `udp_table'
filter.c:(.text+0x8070): undefined reference to `udp_table'
filter.c:(.text+0x808c): undefined reference to `__udp4_lib_lookup'
net/core/filter.o: In function `bpf_sk_release':
filter.c:(.text+0x82e8): undefined reference to `sock_gen_put'
Wrap the related sections of code in #ifdefs for the config option.
Furthermore, sk_lookup() should always have been marked 'static', this
also avoids a warning about a missing prototype when building with
'make W=1'.
Fixes: 6acc9b432e67 ("bpf: Add helper to retrieve socket in BPF")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
---
v2: Modify the patch to remove the related code in preprocessor rather
than relying on compiler optimizations to remove the code.
---
net/core/filter.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 30c6b2d3ef16..4bbc6567fcb8 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4817,8 +4817,9 @@ static const struct bpf_func_proto bpf_lwt_seg6_adjust_srh_proto = {
};
#endif /* CONFIG_IPV6_SEG6_BPF */
-struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,
- struct sk_buff *skb, u8 family, u8 proto)
+#ifdef CONFIG_INET
+static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,
+ struct sk_buff *skb, u8 family, u8 proto)
{
int dif = skb->dev->ifindex;
bool refcounted = false;
@@ -4951,6 +4952,7 @@ static const struct bpf_func_proto bpf_sk_release_proto = {
.ret_type = RET_INTEGER,
.arg1_type = ARG_PTR_TO_SOCKET,
};
+#endif /* CONFIG_INET */
bool bpf_helper_changes_pkt_data(void *func)
{
@@ -5158,12 +5160,14 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
case BPF_FUNC_skb_ancestor_cgroup_id:
return &bpf_skb_ancestor_cgroup_id_proto;
#endif
+#ifdef CONFIG_INET
case BPF_FUNC_sk_lookup_tcp:
return &bpf_sk_lookup_tcp_proto;
case BPF_FUNC_sk_lookup_udp:
return &bpf_sk_lookup_udp_proto;
case BPF_FUNC_sk_release:
return &bpf_sk_release_proto;
+#endif
default:
return bpf_base_func_proto(func_id);
}
@@ -5264,12 +5268,14 @@ sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_sk_redirect_hash_proto;
case BPF_FUNC_get_local_storage:
return &bpf_get_local_storage_proto;
+#ifdef CONFIG_INET
case BPF_FUNC_sk_lookup_tcp:
return &bpf_sk_lookup_tcp_proto;
case BPF_FUNC_sk_lookup_udp:
return &bpf_sk_lookup_udp_proto;
case BPF_FUNC_sk_release:
return &bpf_sk_release_proto;
+#endif
default:
return bpf_base_func_proto(func_id);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv2 bpf-next] bpf: fix building without CONFIG_INET
2018-10-08 18:30 [PATCHv2 bpf-next] bpf: fix building without CONFIG_INET Joe Stringer
@ 2018-10-08 20:52 ` Song Liu
2018-10-08 22:54 ` Daniel Borkmann
0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2018-10-08 20:52 UTC (permalink / raw)
To: joe
Cc: Daniel Borkmann, Arnd Bergmann, Alexei Starovoitov,
David S . Miller, John Fastabend, Martin KaFai Lau,
makita.toshiaki, Lawrence Brakmo, Andrey Ignatov,
Jesper Dangaard Brouer, Jakub Kicinski, Mathieu Xhonneux,
David Ahern, Networking, open list
On Mon, Oct 8, 2018 at 11:30 AM Joe Stringer <joe@wand.net.nz> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added TCP and UDP handling fails to link when CONFIG_INET
> is disabled:
>
> net/core/filter.o: In function `sk_lookup':
> filter.c:(.text+0x7ff8): undefined reference to `tcp_hashinfo'
> filter.c:(.text+0x7ffc): undefined reference to `tcp_hashinfo'
> filter.c:(.text+0x8020): undefined reference to `__inet_lookup_established'
> filter.c:(.text+0x8058): undefined reference to `__inet_lookup_listener'
> filter.c:(.text+0x8068): undefined reference to `udp_table'
> filter.c:(.text+0x8070): undefined reference to `udp_table'
> filter.c:(.text+0x808c): undefined reference to `__udp4_lib_lookup'
> net/core/filter.o: In function `bpf_sk_release':
> filter.c:(.text+0x82e8): undefined reference to `sock_gen_put'
>
> Wrap the related sections of code in #ifdefs for the config option.
>
> Furthermore, sk_lookup() should always have been marked 'static', this
> also avoids a warning about a missing prototype when building with
> 'make W=1'.
>
> Fixes: 6acc9b432e67 ("bpf: Add helper to retrieve socket in BPF")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Joe Stringer <joe@wand.net.nz>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> v2: Modify the patch to remove the related code in preprocessor rather
> than relying on compiler optimizations to remove the code.
> ---
> net/core/filter.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 30c6b2d3ef16..4bbc6567fcb8 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4817,8 +4817,9 @@ static const struct bpf_func_proto bpf_lwt_seg6_adjust_srh_proto = {
> };
> #endif /* CONFIG_IPV6_SEG6_BPF */
>
> -struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,
> - struct sk_buff *skb, u8 family, u8 proto)
> +#ifdef CONFIG_INET
> +static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,
> + struct sk_buff *skb, u8 family, u8 proto)
> {
> int dif = skb->dev->ifindex;
> bool refcounted = false;
> @@ -4951,6 +4952,7 @@ static const struct bpf_func_proto bpf_sk_release_proto = {
> .ret_type = RET_INTEGER,
> .arg1_type = ARG_PTR_TO_SOCKET,
> };
> +#endif /* CONFIG_INET */
>
> bool bpf_helper_changes_pkt_data(void *func)
> {
> @@ -5158,12 +5160,14 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> case BPF_FUNC_skb_ancestor_cgroup_id:
> return &bpf_skb_ancestor_cgroup_id_proto;
> #endif
> +#ifdef CONFIG_INET
> case BPF_FUNC_sk_lookup_tcp:
> return &bpf_sk_lookup_tcp_proto;
> case BPF_FUNC_sk_lookup_udp:
> return &bpf_sk_lookup_udp_proto;
> case BPF_FUNC_sk_release:
> return &bpf_sk_release_proto;
> +#endif
> default:
> return bpf_base_func_proto(func_id);
> }
> @@ -5264,12 +5268,14 @@ sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> return &bpf_sk_redirect_hash_proto;
> case BPF_FUNC_get_local_storage:
> return &bpf_get_local_storage_proto;
> +#ifdef CONFIG_INET
> case BPF_FUNC_sk_lookup_tcp:
> return &bpf_sk_lookup_tcp_proto;
> case BPF_FUNC_sk_lookup_udp:
> return &bpf_sk_lookup_udp_proto;
> case BPF_FUNC_sk_release:
> return &bpf_sk_release_proto;
> +#endif
> default:
> return bpf_base_func_proto(func_id);
> }
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2 bpf-next] bpf: fix building without CONFIG_INET
2018-10-08 20:52 ` Song Liu
@ 2018-10-08 22:54 ` Daniel Borkmann
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-10-08 22:54 UTC (permalink / raw)
To: Song Liu, joe
Cc: Arnd Bergmann, Alexei Starovoitov, David S . Miller,
John Fastabend, Martin KaFai Lau, makita.toshiaki,
Lawrence Brakmo, Andrey Ignatov, Jesper Dangaard Brouer,
Jakub Kicinski, Mathieu Xhonneux, David Ahern, Networking,
open list
On 10/08/2018 10:52 PM, Song Liu wrote:
> On Mon, Oct 8, 2018 at 11:30 AM Joe Stringer <joe@wand.net.nz> wrote:
>>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> The newly added TCP and UDP handling fails to link when CONFIG_INET
>> is disabled:
>>
>> net/core/filter.o: In function `sk_lookup':
>> filter.c:(.text+0x7ff8): undefined reference to `tcp_hashinfo'
>> filter.c:(.text+0x7ffc): undefined reference to `tcp_hashinfo'
>> filter.c:(.text+0x8020): undefined reference to `__inet_lookup_established'
>> filter.c:(.text+0x8058): undefined reference to `__inet_lookup_listener'
>> filter.c:(.text+0x8068): undefined reference to `udp_table'
>> filter.c:(.text+0x8070): undefined reference to `udp_table'
>> filter.c:(.text+0x808c): undefined reference to `__udp4_lib_lookup'
>> net/core/filter.o: In function `bpf_sk_release':
>> filter.c:(.text+0x82e8): undefined reference to `sock_gen_put'
>>
>> Wrap the related sections of code in #ifdefs for the config option.
>>
>> Furthermore, sk_lookup() should always have been marked 'static', this
>> also avoids a warning about a missing prototype when building with
>> 'make W=1'.
>>
>> Fixes: 6acc9b432e67 ("bpf: Add helper to retrieve socket in BPF")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> Signed-off-by: Joe Stringer <joe@wand.net.nz>
>
> Acked-by: Song Liu <songliubraving@fb.com>
Applied to bpf-next, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-08 22:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 18:30 [PATCHv2 bpf-next] bpf: fix building without CONFIG_INET Joe Stringer
2018-10-08 20:52 ` Song Liu
2018-10-08 22:54 ` 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.