net: core: Fix build with CONFIG_IPV6=m
authorJoe Stringer <joe@wand.net.nz>
Wed, 3 Oct 2018 05:32:26 +0000 (22:32 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 4 Oct 2018 08:32:56 +0000 (10:32 +0200)
Stephen Rothwell reports the following link failure with IPv6 as module:

  x86_64-linux-gnu-ld: net/core/filter.o: in function `sk_lookup':
  (.text+0x19219): undefined reference to `__udp6_lib_lookup'

Fix the build by only enabling the IPv6 socket lookup if IPv6 support is
compiled into the kernel.

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/core/filter.c

index 591c698bc5178cd2466cd6a0f5c189c2e5600e43..30c6b2d3ef16203344e4b5e349d8130c37d6a1ff 100644 (file)
@@ -4838,7 +4838,7 @@ struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple,
                        sk = __udp4_lib_lookup(net, src4, tuple->ipv4.sport,
                                               dst4, tuple->ipv4.dport,
                                               dif, sdif, &udp_table, skb);
-#if IS_ENABLED(CONFIG_IPV6)
+#if IS_REACHABLE(CONFIG_IPV6)
        } else {
                struct in6_addr *src6 = (struct in6_addr *)&tuple->ipv6.saddr;
                struct in6_addr *dst6 = (struct in6_addr *)&tuple->ipv6.daddr;