* [PATCH] tipc: fix build issue when building without IPv6
@ 2015-03-19 15:13 Marcelo Ricardo Leitner
2015-03-19 19:04 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-03-19 15:13 UTC (permalink / raw)
To: richard.alpe, jon.maloy, ying.xue, netdev; +Cc: tipc-discussion, erik.hugne
We can't directly call ipv6_sock_mc_join() but should use the stub
instead and protect it around IS_ENABLED.
Fixes: d0f91938bede ("tipc: add ip/udp media type")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
net/tipc/udp_media.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 04836dd70c2bb79906307ec40e0cbd7b2589978e..e64634062aff3633bd91064567fe7a914bd6df32 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -44,6 +44,7 @@
#include <net/sock.h>
#include <net/ip.h>
#include <net/udp_tunnel.h>
+#include <net/addrconf.h>
#include <linux/tipc_netlink.h>
#include "core.h"
#include "bearer.h"
@@ -247,10 +248,13 @@ 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);
+ err = ipv6_stub->ipv6_sock_mc_join(sk, ub->ifindex,
+ &remote->ipv6);
+#endif
}
return err;
}
@@ -387,6 +391,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
tuncfg.encap_destroy = NULL;
setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
+ /* At this point, IPv6 module should have been loaded in
+ * udp_sock_create/sock_create_kern().
+ */
+ BUG_ON(!ipv6_stub);
+
if (enable_mcast(ub, remote))
goto err;
return 0;
--
2.1.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] tipc: fix build issue when building without IPv6
2015-03-19 15:13 [PATCH] tipc: fix build issue when building without IPv6 Marcelo Ricardo Leitner
@ 2015-03-19 19:04 ` David Miller
2015-03-19 19:16 ` Marcelo Ricardo Leitner
2015-03-19 19:47 ` [PATCH v2] " Marcelo Ricardo Leitner
0 siblings, 2 replies; 9+ messages in thread
From: David Miller @ 2015-03-19 19:04 UTC (permalink / raw)
To: marcelo.leitner
Cc: richard.alpe, jon.maloy, ying.xue, netdev, tipc-discussion, erik.hugne
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Thu, 19 Mar 2015 12:13:43 -0300
> @@ -387,6 +391,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
> tuncfg.encap_destroy = NULL;
> setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
>
> + /* At this point, IPv6 module should have been loaded in
> + * udp_sock_create/sock_create_kern().
> + */
> + BUG_ON(!ipv6_stub);
> +
If IPV6=n this will be NULL no matter what.
And if the module load gets an error, this will be NULL as well.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] tipc: fix build issue when building without IPv6
2015-03-19 19:04 ` David Miller
@ 2015-03-19 19:16 ` Marcelo Ricardo Leitner
2015-03-19 19:47 ` [PATCH v2] " Marcelo Ricardo Leitner
1 sibling, 0 replies; 9+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-03-19 19:16 UTC (permalink / raw)
To: David Miller
Cc: richard.alpe, jon.maloy, ying.xue, netdev, tipc-discussion, erik.hugne
On 19-03-2015 16:04, David Miller wrote:
> From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Date: Thu, 19 Mar 2015 12:13:43 -0300
>
>> @@ -387,6 +391,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
>> tuncfg.encap_destroy = NULL;
>> setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
>>
>> + /* At this point, IPv6 module should have been loaded in
>> + * udp_sock_create/sock_create_kern().
>> + */
>> + BUG_ON(!ipv6_stub);
>> +
>
> If IPV6=n this will be NULL no matter what.
>
> And if the module load gets an error, this will be NULL as well.
>
Oh indeed, and it (whatever check) should have been placed in a
ipv6-only path, like vxlan used to do.
Will fix, thanks.
Marcelo
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-19 19:04 ` David Miller
2015-03-19 19:16 ` Marcelo Ricardo Leitner
@ 2015-03-19 19:47 ` Marcelo Ricardo Leitner
2015-03-19 20:06 ` David Miller
1 sibling, 1 reply; 9+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-03-19 19:47 UTC (permalink / raw)
To: richard.alpe, jon.maloy, ying.xue, netdev; +Cc: tipc-discussion, erik.hugne
We can't directly call ipv6_sock_mc_join() but should use the stub
instead and protect it around IS_ENABLED.
Fixes: d0f91938bede ("tipc: add ip/udp media type")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
Notes:
The BUG_ON I had placed is completelly unnecessary:
- with IPV6=n, the code it was trying to protect won't exist
- if the module load fails, the socket creation a bit above
enable_mcast() call will return an error and it will bail out
before reaching that code.
And thus, just removed in this v2.
net/tipc/udp_media.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 04836dd70c2bb79906307ec40e0cbd7b2589978e..ac89101e5d1b62165cbdb070d9f4bebe287fc583 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -44,6 +44,7 @@
#include <net/sock.h>
#include <net/ip.h>
#include <net/udp_tunnel.h>
+#include <net/addrconf.h>
#include <linux/tipc_netlink.h>
#include "core.h"
#include "bearer.h"
@@ -247,10 +248,13 @@ 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);
+ err = ipv6_stub->ipv6_sock_mc_join(sk, ub->ifindex,
+ &remote->ipv6);
+#endif
}
return err;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-19 19:47 ` [PATCH v2] " Marcelo Ricardo Leitner
@ 2015-03-19 20:06 ` David Miller
2015-03-20 2:09 ` Ying Xue
0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2015-03-19 20:06 UTC (permalink / raw)
To: marcelo.leitner
Cc: richard.alpe, jon.maloy, ying.xue, netdev, tipc-discussion, erik.hugne
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Thu, 19 Mar 2015 16:47:58 -0300
> We can't directly call ipv6_sock_mc_join() but should use the stub
> instead and protect it around IS_ENABLED.
>
> Fixes: d0f91938bede ("tipc: add ip/udp media type")
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
This works better, applied, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-19 20:06 ` David Miller
@ 2015-03-20 2:09 ` Ying Xue
2015-03-20 12:35 ` Marcelo
0 siblings, 1 reply; 9+ messages in thread
From: Ying Xue @ 2015-03-20 2:09 UTC (permalink / raw)
To: David Miller, marcelo.leitner
Cc: richard.alpe, jon.maloy, netdev, tipc-discussion, erik.hugne
On 03/20/2015 04:06 AM, David Miller wrote:
> From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Date: Thu, 19 Mar 2015 16:47:58 -0300
>
>> We can't directly call ipv6_sock_mc_join() but should use the stub
>> instead and protect it around IS_ENABLED.
>>
>> Fixes: d0f91938bede ("tipc: add ip/udp media type")
>> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>
Sorry, this patch doesn't work at all especially when IPV6=m and TIPC=y. For
example, when we use the combination of the kernel config options, error appears
like:
net/built-in.o: In function `tipc_udp_send_msg':
/home/ying/work/tipc/tipc2.0/net-next-2.6-debug/net/tipc/udp_media.c:196:
undefined reference to `ip6_dst_lookup'
make: *** [vmlinux] Error 1
Instead, I ever tried to fix the issue several days ago. Please refer to the thread:
https://patchwork.ozlabs.org/patch/448836/
According to the suggestion David gave lastly, we should separate the UDP media
as an independent module, make TIPC_MEDIA_UDP depend on (IPV6 || IPV6=n), and
mark TIPC_MEDIA_UDP tristate. Now I am busy doing this following the proposal.
Regards,
Ying
> This works better, applied, thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-20 2:09 ` Ying Xue
@ 2015-03-20 12:35 ` Marcelo
2015-03-23 3:00 ` Ying Xue
0 siblings, 1 reply; 9+ messages in thread
From: Marcelo @ 2015-03-20 12:35 UTC (permalink / raw)
To: Ying Xue
Cc: David Miller, richard.alpe, jon.maloy, netdev, tipc-discussion,
erik.hugne
On Fri, 20 Mar 2015 10:09:26 +0800, Ying Xue <ying.xue@windriver.com>
wrote:
> On 03/20/2015 04:06 AM, David Miller wrote:
>> From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>> Date: Thu, 19 Mar 2015 16:47:58 -0300
>>
>>> We can't directly call ipv6_sock_mc_join() but should use the stub
>>> instead and protect it around IS_ENABLED.
>>>
>>> Fixes: d0f91938bede ("tipc: add ip/udp media type")
>>> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>>
>
> Sorry, this patch doesn't work at all especially when IPV6=m and TIPC=y.
> For
> example, when we use the combination of the kernel config options, error
> appears
> like:
>
> net/built-in.o: In function `tipc_udp_send_msg':
>
/home/ying/work/tipc/tipc2.0/net-next-2.6-debug/net/tipc/udp_media.c:196:
> undefined reference to `ip6_dst_lookup'
> make: *** [vmlinux] Error 1
>
> Instead, I ever tried to fix the issue several days ago. Please refer to
> the thread:
>
> https://patchwork.ozlabs.org/patch/448836/
>
> According to the suggestion David gave lastly, we should separate the
UDP
> media
> as an independent module, make TIPC_MEDIA_UDP depend on (IPV6 ||
IPV6=n),
> and
> mark TIPC_MEDIA_UDP tristate. Now I am busy doing this following the
> proposal.
I missed your work on the issue, Ying, sorry, otherwise I would have
replied
to that thread instead of posting the patch.
I think David and Willem suggestion were more about the dependencies
than fixing the build issue itself. I mean, if some part of TIPC really
needs IPv6 in order to work or something like that.
So if all we want to do if fix the build issue, I have another suggestion.
When we have IPV6=m and TIPC=y, just have to use the stub too.
(cut & pasted)
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -193,7 +193,7 @@ static int tipc_udp_send_msg(struct net *net, struct
sk_buff *skb,
.saddr = src->ipv6,
.flowi6_proto = IPPROTO_UDP
};
- err = ip6_dst_lookup(ub->ubsock->sk, &ndst, &fl6);
+ err = ipv6_stub->ipv6_dst_lookup(ub->ubsock->sk, &ndst,
&fl6);
if (err)
goto tx_error;
ttl = ip6_dst_hoplimit(ndst);
then it builds fine here. That is, assuming that you can't reach this code
while
ipv6 module is unloaded.. (I didn't check that) what do you think?
Regards,
Marcelo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-20 12:35 ` Marcelo
@ 2015-03-23 3:00 ` Ying Xue
2015-03-23 11:33 ` Marcelo Ricardo Leitner
0 siblings, 1 reply; 9+ messages in thread
From: Ying Xue @ 2015-03-23 3:00 UTC (permalink / raw)
To: Marcelo
Cc: David Miller, richard.alpe, jon.maloy, netdev, tipc-discussion,
erik.hugne
On 03/20/2015 08:35 PM, Marcelo wrote:
> I think David and Willem suggestion were more about the dependencies
> than fixing the build issue itself. I mean, if some part of TIPC really
> needs IPv6 in order to work or something like that.
>
> So if all we want to do if fix the build issue, I have another suggestion.
> When we have IPV6=m and TIPC=y, just have to use the stub too.
>
> (cut & pasted)
> --- a/net/tipc/udp_media.c
> +++ b/net/tipc/udp_media.c
> @@ -193,7 +193,7 @@ static int tipc_udp_send_msg(struct net *net, struct
> sk_buff *skb,
> .saddr = src->ipv6,
> .flowi6_proto = IPPROTO_UDP
> };
> - err = ip6_dst_lookup(ub->ubsock->sk, &ndst, &fl6);
> + err = ipv6_stub->ipv6_dst_lookup(ub->ubsock->sk, &ndst,
> &fl6);
> if (err)
> goto tx_error;
> ttl = ip6_dst_hoplimit(ndst);
>
> then it builds fine here. That is, assuming that you can't reach this code
> while
> ipv6 module is unloaded.. (I didn't check that) what do you think?
It seems that your above change is useless to kill the error. For instance, when
I apply it into my project, below build error appears:
net/tipc/udp_media.c: In function ‘tipc_udp_send_msg’:
net/tipc/udp_media.c:196:18: error: ‘const struct ipv6_stub’ has no member named
‘ip6_dst_lookup’
make[2]: *** [net/tipc/udp_media.o] Error 1
make[1]: *** [net/tipc] Error 2
make: *** [net] Error 2
In my opinion, we have to follow David's suggestion dividing the udp_media.c as
an separate module.
Regards,
Ying
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] tipc: fix build issue when building without IPv6
2015-03-23 3:00 ` Ying Xue
@ 2015-03-23 11:33 ` Marcelo Ricardo Leitner
0 siblings, 0 replies; 9+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-03-23 11:33 UTC (permalink / raw)
To: Ying Xue
Cc: David Miller, richard.alpe, jon.maloy, netdev, tipc-discussion,
erik.hugne
On 23-03-2015 00:00, Ying Xue wrote:
> On 03/20/2015 08:35 PM, Marcelo wrote:
>> I think David and Willem suggestion were more about the dependencies
>> than fixing the build issue itself. I mean, if some part of TIPC really
>> needs IPv6 in order to work or something like that.
>>
>> So if all we want to do if fix the build issue, I have another suggestion.
>> When we have IPV6=m and TIPC=y, just have to use the stub too.
>>
>> (cut & pasted)
>> --- a/net/tipc/udp_media.c
>> +++ b/net/tipc/udp_media.c
>> @@ -193,7 +193,7 @@ static int tipc_udp_send_msg(struct net *net, struct
>> sk_buff *skb,
>> .saddr = src->ipv6,
>> .flowi6_proto = IPPROTO_UDP
>> };
>> - err = ip6_dst_lookup(ub->ubsock->sk, &ndst, &fl6);
>> + err = ipv6_stub->ipv6_dst_lookup(ub->ubsock->sk, &ndst,
>> &fl6);
>> if (err)
>> goto tx_error;
>> ttl = ip6_dst_hoplimit(ndst);
>>
>> then it builds fine here. That is, assuming that you can't reach this code
>> while
>> ipv6 module is unloaded.. (I didn't check that) what do you think?
>
> It seems that your above change is useless to kill the error. For instance, when
> I apply it into my project, below build error appears:
>
> net/tipc/udp_media.c: In function ‘tipc_udp_send_msg’:
> net/tipc/udp_media.c:196:18: error: ‘const struct ipv6_stub’ has no member named
> ‘ip6_dst_lookup’
> make[2]: *** [net/tipc/udp_media.o] Error 1
> make[1]: *** [net/tipc] Error 2
> make: *** [net] Error 2
>
> In my opinion, we have to follow David's suggestion dividing the udp_media.c as
> an separate module.
If you had checked which members ipv6_stub has, you would have noticed
the member name has an extra 'v' than the actual function name.
ip6_ -> ipv6_
How it goes then?
Regards,
Marcelo
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-03-23 11:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 15:13 [PATCH] tipc: fix build issue when building without IPv6 Marcelo Ricardo Leitner
2015-03-19 19:04 ` David Miller
2015-03-19 19:16 ` Marcelo Ricardo Leitner
2015-03-19 19:47 ` [PATCH v2] " Marcelo Ricardo Leitner
2015-03-19 20:06 ` David Miller
2015-03-20 2:09 ` Ying Xue
2015-03-20 12:35 ` Marcelo
2015-03-23 3:00 ` Ying Xue
2015-03-23 11:33 ` Marcelo Ricardo Leitner
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.