netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v3] tipc: fix undefined __ipv6_sock_mc_join compile error
@ 2015-03-11  7:51 Ying Xue
  2015-03-11 21:59 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ying Xue @ 2015-03-11  7:51 UTC (permalink / raw)
  To: davem
  Cc: jon.maloy, willemb, netdev, Paul.Gortmaker, tipc-discussion,
	kbuild-all, fengguang.wu

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=y || IPV6=n) to avoid the error.

Fixes: d0f91938bede ("tipc: add ip/udp media type")
Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Kbuild test robot <kbuild-all@01.org>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: Ying Xue <ying.xue@windriver.com>
---
v3:
  - Move the new dependency from TIPC to TIPC_MEDIA_UDP, which is
    suggested by Willem and David
  - Change IPV6 of new dependency to IPV6=y
  - Change initial err value from 0 to -EAFNOSUPPORT suggested by
    Willem
v2:
  - Fix another compile error when TIPC=y, TIPC_MEDIA_UDP=y, and IPV6=m

 net/tipc/Kconfig     |    1 +
 net/tipc/udp_media.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index c25a3a1..5bb8fc9 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -29,6 +29,7 @@ config TIPC_MEDIA_IB
 config TIPC_MEDIA_UDP
 	bool "IP/UDP media type support"
 	depends on TIPC
+	depends on (IPV6=y || IPV6=n)
 	select NET_UDP_TUNNEL
 	help
 	  Saying Y here will enable support for running TIPC over IP/UDP
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index fc2fb11..ee0329d 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -148,7 +148,7 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
 			     struct tipc_bearer *b,
 			     struct tipc_media_addr *dest)
 {
-	int ttl, err = 0;
+	int ttl, err = -EAFNOSUPPORT;
 	struct udp_bearer *ub;
 	struct udp_media_addr *dst = (struct udp_media_addr *)&dest->value;
 	struct udp_media_addr *src = (struct udp_media_addr *)&b->addr.value;
@@ -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 {
 		if (!ipv6_addr_is_multicast(&remote->ipv6))
 			return 0;
 		err = __ipv6_sock_mc_join(sk, ub->ifindex, &remote->ipv6);
+#endif
 	}
 	return err;
 }
-- 
1.7.9.5


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] tipc: fix undefined __ipv6_sock_mc_join compile error
  2015-03-11  7:51 [PATCH net-next v3] tipc: fix undefined __ipv6_sock_mc_join compile error Ying Xue
@ 2015-03-11 21:59 ` David Miller
  2015-03-12  3:35   ` Ying Xue
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2015-03-11 21:59 UTC (permalink / raw)
  To: ying.xue
  Cc: jon.maloy, Paul.Gortmaker, erik.hugne, fengguang.wu, netdev,
	willemb, tipc-discussion, kbuild-all

From: Ying Xue <ying.xue@windriver.com>
Date: Wed, 11 Mar 2015 15:51:13 +0800

> diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
> index c25a3a1..5bb8fc9 100644
> --- a/net/tipc/Kconfig
> +++ b/net/tipc/Kconfig
> @@ -29,6 +29,7 @@ config TIPC_MEDIA_IB
>  config TIPC_MEDIA_UDP
>  	bool "IP/UDP media type support"
>  	depends on TIPC
> +	depends on (IPV6=y || IPV6=n)
>  	select NET_UDP_TUNNEL
>  	help
>  	  Saying Y here will enable support for running TIPC over IP/UDP

This really is not what you want.

You want to enable TIPC_MEDIA_UDP if IPV6 is "compatible" with TIPC,
what you're using here is a sledgehammer.

I would really suggest breaking this facility out into it's own
module, then you can mark it tristate and do this correctly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] tipc: fix undefined __ipv6_sock_mc_join compile error
  2015-03-11 21:59 ` David Miller
@ 2015-03-12  3:35   ` Ying Xue
  0 siblings, 0 replies; 3+ messages in thread
From: Ying Xue @ 2015-03-12  3:35 UTC (permalink / raw)
  To: David Miller
  Cc: jon.maloy, Paul.Gortmaker, erik.hugne, fengguang.wu, netdev,
	willemb, tipc-discussion, kbuild-all

On 03/12/2015 05:59 AM, David Miller wrote:
> From: Ying Xue <ying.xue@windriver.com>
> Date: Wed, 11 Mar 2015 15:51:13 +0800
> 
>> diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
>> index c25a3a1..5bb8fc9 100644
>> --- a/net/tipc/Kconfig
>> +++ b/net/tipc/Kconfig
>> @@ -29,6 +29,7 @@ config TIPC_MEDIA_IB
>>  config TIPC_MEDIA_UDP
>>  	bool "IP/UDP media type support"
>>  	depends on TIPC
>> +	depends on (IPV6=y || IPV6=n)
>>  	select NET_UDP_TUNNEL
>>  	help
>>  	  Saying Y here will enable support for running TIPC over IP/UDP
> 
> This really is not what you want.
> 
> You want to enable TIPC_MEDIA_UDP if IPV6 is "compatible" with TIPC,
> what you're using here is a sledgehammer.
> 
> I would really suggest breaking this facility out into it's own
> module, then you can mark it tristate and do this correctly.
> 
> 

Thank you for the review. OK, I will change the code again following your
suggestions.

Regards,
Ying

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-12  3:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11  7:51 [PATCH net-next v3] tipc: fix undefined __ipv6_sock_mc_join compile error Ying Xue
2015-03-11 21:59 ` David Miller
2015-03-12  3:35   ` Ying Xue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).