]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix building without CONFIG_INET
authorArnd Bergmann <arnd@arndb.de>
Mon, 8 Oct 2018 18:30:01 +0000 (11:30 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Oct 2018 22:49:44 +0000 (00:49 +0200)
commit7b0ddb46a9e6d692baf0c6651c67ddf1bb0d783b
tree5b4c4b9eb179e8efe37c2a3efee01792578ba3e5
parent97c75f2b9c60ce7702d64631b9b08ac8b57cb782
bpf: fix building without CONFIG_INET

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: 4b8337ef7be8 ("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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/core/filter.c