Subject: Re: [PATCH net-next v2] tipc: fix undefined __ipv6_sock_mc_join compile error

From: Sergei Shtylyov <[email-masked]>
Date: Tue, 10 Mar 2015 21:50:09 +0300

Hello.

On 03/10/2015 11:41 AM, Ying Xue wrote:

> When CONFIG_IPV6 option is disabled, below error will appear while
> building TIPC module:

> ERROR: "__ipv6_sock_mc_join" [net/tipc/tipc.ko] undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [net/tipc/tipc.ko] Error 1

> This is because we don't check whether or not the CONFIG_IPV6 is
> enabled when calling __ipv6_sock_mc_join().

> In addition, especially when TIPC=y, TIPC_MEDIA_UDP=y, and IPV6=m, TIPC
> module is also unable to be successfully built. Therefore, we add a
> dependency condition like (IPV6 || IPV6=n) to avoid the error.

> Fixes: d0f91938bede ("tipc: add ip/udp media type")
> Reported-by: Wu Fengguang <[email-masked]>
> Cc: Kbuild test robot <[email-masked]>
> Signed-off-by: Ying Xue <[email-masked]>
> ---
> v2:
>   Fix another compile error when TIPC=y, TIPC_MEDIA_UDP=y, and IPV6=m

>   net/tipc/Kconfig     |    1 +
>   net/tipc/udp_media.c |    2 ++
>   2 files changed, 3 insertions(+)

> diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
> index c25a3a1..6f217ba 100644
> --- a/net/tipc/Kconfig
> +++ b/net/tipc/Kconfig
> @@ -5,6 +5,7 @@
>   menuconfig TIPC
>   	tristate "The TIPC Protocol"
>   	depends on INET
> +	depends on (IPV6 || IPV6=n)

    Parens not needed.

[...]
> diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
> index fc2fb11..6763002 100644
> --- a/net/tipc/udp_media.c
> +++ b/net/tipc/udp_media.c
> @@ -247,10 +247,12 @@ static int enable_mcast(struct udp_bearer *ub, struct udp_media_addr *remote)
>   		mreqn.imr_multiaddr = remote->ipv4;
>   		mreqn.imr_ifindex = ub->ifindex;
>   		err = __ip_mc_join_group(sk, &mreqn);
> +#if IS_ENABLED(CONFIG_IPV6)
>   	} else {

    How about:

	} else if (IS_ENABLED(CONFIG_IPV6)) {

>   		if (!ipv6_addr_is_multicast(&remote->ipv6))
>   			return 0;
>   		err = __ipv6_sock_mc_join(sk, ub->ifindex, &remote->ipv6);
> +#endif
>   	}
>   	return err;
>   }

WBR, Sergei