Merge conflicts in mroute.c (was: Re: openvpn-testing tree available)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi guys!
Quoted 1 line · JuanJo Ciarlante
On Wed, Feb 17, 2010 at 6:46 PM, JuanJo Ciarlante <[email protected]...>
Quoted 5 lines · wrote:
Quoted 4 lines
I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a
mroute.cchunk IIRC.
Even though I know you both have told me that there would be a merge conflict in mroute.c, I decided to put it on the mailing list - hopefully to get an open discussion about it!
I've attached the merge conflict. It would be great if you could sort this out soon. Then I'll get both of your trees into the allmerged branch ASAP. Right now only Gert's code is in the allmerged branch.
What I do see might be a challenge (without knowing the code in details), is that JJO's code is using #ifdef, while Gert's code is not.
With a conflict in mroute_addr_print_ex(), which includes an #ifdef I
see a potential disaster here.
Personally, I would like to evaluate Gert's patches to see if they could be #ifdef'ed. Then both IPv6 branches can both use USE_PF_INET6 to enable or disable the IPv6 support. I have not studied these patches, so I don't know how doable that is. And this is my personal opinion, I don't mean to instruct anyone into a direction. I will let you guys find the proper direction.
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt+caIACgkQDC186MBRfrr5ZACgqLxiXN70pCOGY0zyvQGSCpo6 n2EAn1le6hzZe4aThLfAKvYwK7d3CPSG
=e7yX
-----END PGP SIGNATURE-----
mroute.c +0 -0
@@@ -399,24 -359,47 +421,68 @@@ mroute_addr_print_ex (const struct mrou }break ;case MR_ADDR_IPV6 : ++<<<<<<< HEAD + { +buf_printf (&out,"%s" , +print_in6_addr ( *(struct in6_addr *)&maddr.addr,0 , gc)); + if (maddr.type & MR_WITH_NETBITS) + { +buf_printf (&out,"/%d" , maddr.netbits); + } + } + break; + default: +buf_printf (&out,"UNKNOWN" ); + break; + } + return BSTR (&out); + } + else + return"[NULL]" ; + } ++======= +#ifdef USE_PF_INET6 + { +struct buffer buf; +struct sockaddr_in6 sin6; +int port; +char buf6[INET6_ADDRSTRLEN ] ="" ; +CLEAR (sin6); + sin6.sin6_family =AF_INET6 ; +buf_set_read (&buf, maddr.addr, maddr.len); +if (buf_read (&buf, &sin6.sin6_addr,sizeof (sin6.sin6_addr))) + { +if (getnameinfo ((struct sockaddr *)&sin6,sizeof (struct sockaddr_in6 ), + buf6,sizeof (buf6),NULL ,0 ,NI_NUMERICHOST ) !=0 ) + { +buf_printf (&out,"MR_ADDR_IPV6 getnameinfo() err" ); +break ; + } +buf_puts (&out, buf6); +if (maddr.type &MR_WITH_NETBITS ) +buf_printf (&out,"/%d" , maddr.netbits); +if (maddr.type &MR_WITH_PORT ) + { + port =buf_read_u16 (&buf); +if (port >=0 ) +buf_printf (&out,":%d" , port); + } + } + } +#else /* old, pre USE_PF_INET6 code */ +buf_printf (&out,"IPV6" ); +#endif +break ; +default : +buf_printf (&out,"UNKNOWN" ); +break ; + } +return BSTR (&out); + } +else +return "[NULL]" ; + } ++>>>>>>> feat_ipv6_transport/* * mroute_helper's main job is keeping track of
Hi,
Quoted 7 lines · David Sommerseth
Quoted 3 lines
Quoted 3 lines
I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a
mroute.cchunk IIRC.Even though I know you both have told me that there would be a merge conflict in
mroute.c, I decided to put it on the mailing list - hopefully to get an open discussion about it!
Good :-)
Quoted 3 lines
I've attached the merge conflict. It would be great if you could sort this out soon. Then I'll get both of your trees into the allmerged branch ASAP. Right now only Gert's code is in the allmerged branch.
For the allmerged, you could use either one, or none at all(!) :-)
*I* think you should use mine, of course. Reason explained below.
Quoted 4 lines
What I do see might be a challenge (without knowing the code in details), is that JJO's code is using #ifdef, while Gert's code is not.
With a conflict inmroute_addr_print_ex(), which includes an #ifdef I
see a potential disaster here.
The code basically does the same thing "add printing of the IPv6 information for a mroute structure containing IPv6 information".
For OpenVPN to *work*, you need neither, it's just helpful diagnostic output :-) - if the code is unpatched, it will just do
buf_printf (&out, "IPV6");
for IPv6 mroutes, but not error-abort or fail. So no danger here.
Now, for the different patches.
My patch "just prints the IPv6 address", using a helper function that I added elsewhere (print_in6_addr()). This function is not available in the official tree, so JJO cannot use it for his branch.
JJO's patch does more than that, he does DNS lookups to print the DNS name for the IPv6 address in question. Now we enter religious territory - *I* think that this is not a good thing. The existing code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.
JJO's patch also adds the port number for MR_WITH_PORT mroutes - which is something that never happens for my usage of IPv6 mroutes for IPv6 payload - but that could be easily added to my code.
Quoted 6 lines
Personally, I would like to evaluate Gert's patches to see if they could be #ifdef'ed. Then both IPv6 branches can both use
USE_PF_INET6to enable or disable the IPv6 support. I have not studied these patches, so I don't know how doable that is. And this is my personal opinion, I don't mean to instruct anyone into a direction. I will let you guys find the proper direction.
Most changes of my patch could be #ifdef'ed easily - places that just add extra lines of code, extra fields to a structure, and such. That's the easy stuff.
Other parts are much harder, changes like this one:
/* possibly add routes */
if (!c->options.route_delay_defined)- do_route (&c->options, c->c1.route_list, c->c1.tuntap, c->plugins, c->c2
.es);
+ do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list,
+ c->c1.tuntap, c->plugins, c->c2.es);
... where I had to add extra arguments to a function call. #ifdef'ing that is going to produce really ugly and much harder-to-maintain code (because you have to have an #else, with the old call syntax, and future changes of this function call always have to adjust *both* changes).
I've just re-checked JJO's patch - the #ifdef's in there don't cover all the changes either, just the IPv6-specific stuff. The necessary changes to the existing IPv4 infrastructure (data structures etc) are not #ifdef'ed - so the #ifdef's here don't serve to deactivate the whole patch, but only to disable the actual IPv6 transport functionality.
Personally, I'm not a big fan of #ifdef'ing changes that affect so many different places of the code (JJO's patch has 109 chunks, my patch has 119 chunks) because it will make the code much harder to read, and also harder to test ("how many different combinations of compile-time options need to be enabled to cover all possible code paths?").
But if that is what it takes to get the code integrated in the main source, that's what I'll do.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 7 lines · Gert Doering
Hi,
Quoted 4 lines · David Sommerseth
Quoted 3 lines
Quoted 3 lines
I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a
mroute.cchunk IIRC.
Quoted 5 lines
Quoted 3 lines
Even though I know you both have told me that there would be a merge conflict in
mroute.c, I decided to put it on the mailing list - hopefully to get an open discussion about it!Good :-)
Indeed ... FigHT!! :)
Quoted 8 lines
Quoted 4 lines
I've attached the merge conflict. It would be great if you could sort this out soon. Then I'll get both of your trees into the allmerged branch ASAP. Right now only Gert's code is in the allmerged branch.
For the allmerged, you could use either one, or none at all(!) :-)
*I* think you should use mine, of course. Reason explained below.
I agree, but not for the reason you expose ... but just because you "own" this 6layer.
Quoted 18 lines
Quoted 6 lines
What I do see might be a challenge (without knowing the code in details), is that JJO's code is using #ifdef, while Gert's code is not. With a conflict in
mroute_addr_print_ex(), which includes an #ifdef I see a potential disaster here.The code basically does the same thing "add printing of the IPv6 information for a mroute structure containing IPv6 information".
For OpenVPN to *work*, you need neither, it's just helpful diagnostic output :-) - if the code is unpatched, it will just do
buf_printf(&out, "IPV6");for IPv6 mroutes, but not error-abort or fail. So no danger here.
Quoted 8 lines
Now, for the different patches.
My patch "just prints the IPv6 address", using a helper function that I added elsewhere (
print_in6_addr()). This function is not available in the official tree, so JJO cannot use it for his branch.JJO's patch does more than that, he does DNS lookups to print the DNS name for the IPv6 address in question.
Wrong.
From getaddrinfo(3):
"""
If hints.ai_flags contains the AI_NUMERICHOST flag then the node parameter must be a numerical network address.
The AI_NUMERICHOST flag suppresses any potentially lengthy network host address lookups.
"""
Quoted 2 lines
Now we enter religious
territory - *I* think that this is not a good thing.
I can't more eagerly _agree_ on tossing out any reverse DNS lookups at this level.
Quoted 6 lines
The existing
code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.
IMO we should void using inet_ntop() and friends, personally I don't like locking around their lack of multi-threading.
Quoted 50 lines
JJO's patch also adds the port number for
MR_WITH_PORTmroutes - which is something that never happens for my usage of IPv6 mroutes for IPv6 payload - but that could be easily added to my code.Quoted 6 lines
Personally, I would like to evaluate Gert's patches to see if they could be #ifdef'ed. Then both IPv6 branches can both use
USE_PF_INET6to enable or disable the IPv6 support. I have not studied these patches, so I don't know how doable that is. And this is my personal opinion, I don't mean to instruct anyone into a direction. I will let you guys find the proper direction.Most changes of my patch could be #ifdef'ed easily - places that just add extra lines of code, extra fields to a structure, and such. That's the easy stuff.
Other parts are much harder, changes like this one:
/* possibly add routes */
if (!c->options.route_delay_defined)
-do_route(&c->options,c->c1.route_list,c->c1.tuntap,c->plugins,c->c2.es);
+do_route(&c->options,c->c1.route_list,c->c1.route_ipv6_list,
+c->c1.tuntap,c->plugins,c->c2.es);... where I had to add extra arguments to a function call. #ifdef'ing that is going to produce really ugly and much harder-to-maintain code (because you have to have an #else, with the old call syntax, and future changes of this function call always have to adjust *both* changes).
I've just re-checked JJO's patch - the #ifdef's in there don't cover all the changes either, just the IPv6-specific stuff. The necessary changes to the existing IPv4 infrastructure (data structures etc) are not #ifdef'ed - so the #ifdef's here don't serve to deactivate the whole patch, but only to disable the actual IPv6 transport functionality.
Personally, I'm not a big fan of #ifdef'ing changes that affect so many different places of the code (JJO's patch has 109 chunks, my patch has 119 chunks) because it will make the code much harder to read, and also harder to test ("how many different combinations of compile-time options need to be enabled to cover all possible code paths?").
But if that is what it takes to get the code integrated in the main source, that's what I'll do.
Quoted 7 lines
gert
--
USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
Cheers,
Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 30 lines · Gert Doering
Hi,
Quoted 7 lines · David Sommerseth
Quoted 3 lines
Quoted 3 lines
I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a
mroute.cchunk IIRC.Even though I know you both have told me that there would be a merge conflict in
mroute.c, I decided to put it on the mailing list - hopefully to get an open discussion about it!Good :-)
Quoted 3 lines
I've attached the merge conflict. It would be great if you could sort this out soon. Then I'll get both of your trees into the allmerged branch ASAP. Right now only Gert's code is in the allmerged branch.
For the allmerged, you could use either one, or none at all(!) :-)
*I* think you should use mine, of course. Reason explained below.
Quoted 4 lines
What I do see might be a challenge (without knowing the code in details), is that JJO's code is using #ifdef, while Gert's code is not.
With a conflict inmroute_addr_print_ex(), which includes an #ifdef I
see a potential disaster here.The code basically does the same thing "add printing of the IPv6 information for a mroute structure containing IPv6 information".
Quoted 6 lines
For OpenVPN to *work*, you need neither, it's just helpful diagnostic output :-) - if the code is unpatched, it will just do
buf_printf (&out, "IPV6");for IPv6 mroutes, but not error-abort or fail. So no danger here.
Sounds good.
Quoted 5 lines
Now, for the different patches.
My patch "just prints the IPv6 address", using a helper function that I added elsewhere (
print_in6_addr()). This function is not available in the official tree, so JJO cannot use it for his branch.
Unless he merges in that needed function ;-)
Quoted 9 lines
JJO's patch does more than that, he does DNS lookups to print the DNS name for the IPv6 address in question. Now we enter religious territory - *I* think that this is not a good thing. The existing code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.
Quoted 3 lines
JJO's patch also adds the port number for
MR_WITH_PORTmroutes - which is something that never happens for my usage of IPv6 mroutes for IPv6 payload - but that could be easily added to my code.
I have no opinion of what would be good or not in this regard ... I'm just saying: Make these branches in a state where we can merge them into allmerged. I'll leave the battleground to be fought between you two :)
Quoted 35 lines
Quoted 6 lines
Personally, I would like to evaluate Gert's patches to see if they could be #ifdef'ed. Then both IPv6 branches can both use
USE_PF_INET6to enable or disable the IPv6 support. I have not studied these patches, so I don't know how doable that is. And this is my personal opinion, I don't mean to instruct anyone into a direction. I will let you guys find the proper direction.Most changes of my patch could be #ifdef'ed easily - places that just add extra lines of code, extra fields to a structure, and such. That's the easy stuff.
Other parts are much harder, changes like this one:
/* possibly add routes */ if (!c->options.route_delay_defined)-
do_route(&c->options,c->c1.route_list,c->c1.tuntap,c->plugins,c->c2
.es);(quoted diff) +2
-0+ do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, c->plugins, c->c2.es);... where I had to add extra arguments to a function call. #ifdef'ing that is going to produce really ugly and much harder-to-maintain code (because you have to have an #else, with the old call syntax, and future changes of this function call always have to adjust *both* changes).
I've just re-checked JJO's patch - the #ifdef's in there don't cover all the changes either, just the IPv6-specific stuff. The necessary changes to the existing IPv4 infrastructure (data structures etc) are not #ifdef'ed - so the #ifdef's here don't serve to deactivate the whole patch, but only to disable the actual IPv6 transport functionality.
Quoted 9 lines
Personally, I'm not a big fan of #ifdef'ing changes that affect so many different places of the code (JJO's patch has 109 chunks, my patch has 119 chunks) because it will make the code much harder to read, and also harder to test ("how many different combinations of compile-time options need to be enabled to cover all possible code paths?").
But if that is what it takes to get the code integrated in the main source, that's what I'll do.
I know that James prefer #ifdef. So if you want to have a safer bet that this code goes into a stable tree, #ifdef will be a plus point for inclusion. This is also the main reason why I am advocating #ifdef in this part if the code.
On the other hand, there are drawbacks to #ifdef in regards to maintenance, which you've put very well in your answer. And of course the possibility of compile and run-time conflicts between #ifdef'ed code. Where some #ifdef's either depend on other ones without really being aware of it, or that it causes other issues during run-time.
I'm fine with whichever path you choose. But just bear in mind, some systems might not have IPv6 support - which breaks portability ... and #ifdef will make it easier for James to accept the patches.
I trust you guys will figure out how to go forward!
kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt+oFgACgkQDC186MBRfrqXPACgiEOyi9QaH00WWmYD1DPmvlVH wdQAnizs7ZGvHJc1EwcWaFRLjMkI/uSO
=AqI4
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line · JuanJo Ciarlante
On Fri, Feb 19, 2010 at 2:46 PM, Gert Doering <[email protected]...> wrote:
[...snip...]
Quoted 9 lines
Quoted 6 lines
The existing
code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.IMO we should void using
inet_ntop()and friends, personally I don't like locking around their lack of multi-threading.
I believe this is a general discussion which will come often up.
Even though OpenVPN is not multi-threaded today, there are no guarantee that this will not change. If we get an implementation which will handle multi-threading, I will favour that one. I believe OpenVPN will in the future need to bite the (bitter?) apple and really look into threading.
So I lean towards JJO here, as far as possible, avoid using functions which are not thread safe.
[...snip...]
Kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkt+oYEACgkQDC186MBRfrp6FQCeLSKI7OVRHzj09+ATRpP31Lbn pz0An2X4oqoGbu8syFHmLP5vxqHDAt2p
=qQXQ
-----END PGP SIGNATURE-----
Hi,
Quoted 11 lines · JuanJo Ciarlante
Quoted 2 lines
JJO's patch does more than that, he does DNS lookups to print the DNS name for the IPv6 address in question.
Wrong.
From getaddrinfo(3):
"""
If hints.ai_flags contains theAI_NUMERICHOSTflag then the node parameter must be a numerical network address.
TheAI_NUMERICHOSTflag suppresses any potentially lengthy network host address lookups.
"""
Ah! Learned something new today. So what's the specific advantage of using getnameinfo() instead of inet_ntop() instead?
(I've only ever used getnameinfo() if I really wanted to do DNS lookups).
Quoted 5 lines
Quoted 2 lines
Now we enter religious
territory - *I* think that this is not a good thing.I can't more eagerly _agree_ on tossing out any reverse DNS lookups at this level.
OK, good. Glad that this was just a misreading of the code.
Quoted 9 lines
Quoted 6 lines
The existing
code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.IMO we should void using
inet_ntop()and friends, personally I don't like locking around their lack of multi-threading.
Mmmh, ok. I wasn't aware that inet_ntop() is not thread-safe. (Looking at the FreeBSD implementation, at least that one *is* thread-safe - no static buffers, etc.).
If it is not thread-safe, it won't break anything in my code, though (lucky me :-) ) - my use of it in print_in6_addr() is mutex-locked anyway, due to the use of a static buffer there.
Is getnameinfo() *guaranteed* to be thread-safe?
Do you have a reference that documents that inet_ntop() and inet_pton() are unsave to be used in a threaded context?
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 2 lines · David Sommerseth
So I lean towards JJO here, as far as possible, avoid using functions which are not thread safe.
I'm not yet convinced that inet_ntop() is actuall not thread-save - but independent of that, it's not a tie-breaker here :-)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 2 lines · David Sommerseth
I'm fine with whichever path you choose. But just bear in mind, some systems might not have IPv6 support - which breaks portability ...
On the unixish side, there is no system which has tun/tap today but does not have IPv6.
On Windows, this might indeed be a killer argument to do some #idef'ing
- what's the oldest version of Windows officially supported by OpenVPN?
(XP and up has IPv6, everything before that does not)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 6 lines · Gert Doering
Hi,
Quoted 2 lines · David Sommerseth
I'm fine with whichever path you choose. But just bear in mind, some systems might not have IPv6 support - which breaks portability ...
Quoted 7 lines
On the unixish side, there is no system which has tun/tap today but does not have IPv6.
On Windows, this might indeed be a killer argument to do some #idef'ing
- what's the oldest version of Windows officially supported by OpenVPN?(XP and up has IPv6, everything before that does not)
It would be reasonable to state that OpenVPN 2.1.2 (or some-such) requires XP SP3 or newer. The other, older, versions have not had official support from Microsoft for quite some time now.
---
Eric Crist
Re: [Openvpn-devel] [IPv6] Merge conflicts in mroute.c
In reply to Gert DoeringQuoted 4 lines
Quoted 2 lines
I'm fine with whichever path you choose. But just bear in mind, some systems might not have IPv6 support - which breaks portability ...
On the unixish side, there is no system which has tun/tap today but does not have IPv6.
What about embedded systems using uclibc compiled "without ipv6 support"? Or is that some different kind of "support" that wouldn't affect your code?
Stefan
Re: [Openvpn-devel] [IPv6] Merge conflicts in mroute.c
Hi,
Quoted 6 lines · Stefan Monnier
Quoted 4 lines
Quoted 2 lines
I'm fine with whichever path you choose. But just bear in mind, some systems might not have IPv6 support - which breaks portability ...
On the unixish side, there is no system which has tun/tap today but does not have IPv6.
What about embedded systems using uclibc compiled "without ipv6 support"?
I have not yet encountered any such system. That doesn't mean they don't exist, it's just "I have not yet seen them".
My OpenWRT does IPv6, and that's the smallest system I have.
Quoted 1 line
Or is that some different kind of "support" that wouldn't affect your code?
I have to investigate.
I'd assume that the necessary header files (that provide necessary compile- time things like "struct in6_addr") are still complete, and that only the run-time which is installed on the device itself will be reduced.
If the net effect of the change is "function calls like inet_ntop() are there but refuse to handle AF_INET6 things (with an error message)", it won't break OpenVPN - the IPv6 stuff will not work, but it will not break the IPv4 stuff.
If the net effect is "dynamic linking fails because inet_ntop() or getaddrinfo() are not even available in the library", this would be very bad - but it would be surprising, since developers have been told to use the address-family independent functions (like getaddrinfo()) for 10 years now, so this would break more applications.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Re: [Openvpn-devel] [IPv6] Merge conflicts in mroute.c
Hi,
Quoted 3 lines · Gert Doering
Quoted 1 line
[uclibc without
UCLIBC_HAS_IPV6]I have to investigate.
And so I did. The impact of UCLIBC_HAS_IPV6=0 is fairly low:
- getaddrinfo() will not resolve IPv6 addresses (but *will* be available)
- the external globals in6addr_any and in6addr_loopback will not be compiled in (in6_addr.c).
** I expect this to cause linking problems for my code **
- inet_ntop6() and inet_pton6() will not be compiled-in - both are only called indirectly, from inet_ntop() and inet_pton(), respectively, for af AF_INET6. So trying to convert IPv6 addresses will fail at run-time.
[side note: that's actually the same code as in the FreeBSD libc, and as such, fully threadsafe :-) )
- __opensock() refuses AF_INET6 sockets at run-time
- the resolv.c functions (gethostbyname2, gethostbyaddr, __dns_lookup, __read_etc_hosts_r, gethostent, ...) will not resolve / handle IPv6 addresses
- the relevant *definitions* (struct in6_addr etc) are all there, all the time, and not depending on UCLIBC_HAS_IPV6.
I don't have a system available for testing, but I would expect that OpenVPN with my patches compiled/linked against an IPv4-only uClibc would fail due to unavailability of "in6addr_any", which can be fairly easily worked-around [reports welcome!].
The other stuff should not cause any adverse run-time effects - if IPv6 isn't compiled in the library, OpenVPN will just not accept "--ifconfig-ipv6" and similar commands (because parsing the IPv6 addresses fails, and thus the addresses are refused as "invalid"), but everything else will just work as-is.
As said: I would welcome contact to someone who is using uClibc+OpenVPN and could help me test this and adapt the code if needed.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Re: [Openvpn-devel] [IPv6] Merge conflicts in mroute.c
Quoted 9 lines · Gert Doering
- the external globals
in6addr_anyandin6addr_loopbackwill not be compiled in (in6_addr.c).** I expect this to cause linking problems for my code **
As said: I would welcome contact to someone who is using uClibc+OpenVPN
and could help me test this and adapt the code if needed.
To run the risk of harping on a theme....
If the problem is that someone is './configure --no-ipv6'-ing ipv6 away then maybe openvpn needs to have a similar ./configure option? Or could ./configure just test against UCLIBC_HAS_IPV6?
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Re: [Openvpn-devel] [IPv6] Merge conflicts in mroute.c
Hi,
Quoted 9 lines · Karl O. Pinc
Quoted 3 lines
As said: I would welcome contact to someone who is using uClibc+OpenVPN
and could help me test this and adapt the code if needed.To run the risk of harping on a theme....
If the problem is that someone is './configure --no-ipv6'-ing ipv6 away then maybe openvpn needs to have a similar ./configure option? Or could ./configure just test against
UCLIBC_HAS_IPV6?
This is where this discussion started: do we really need to #ifdef the IPv6 related code in OpenVPN, or can we assume that any recent OS that has tun/tap will provide the necessary functions anyway.
Adding lots of #ifdefs doesn't improve code readability and feature testing, and makes future maintenance harder (because it's not always obvious if something you change might break a different combination of optional compile-time features that what you use).
For uClibc, the answer could be "it should be sufficient to just define 'in6_addr_any' locally in OpenVPN code, if uClibc is detected" - that's just 16 bytes of static data.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 36 lines · Gert Doering
Hi,
Quoted 11 lines · JuanJo Ciarlante
Quoted 2 lines
JJO's patch does more than that, he does DNS lookups to print the DNS name for the IPv6 address in question.
Wrong.
From getaddrinfo(3):
"""
If hints.ai_flags contains theAI_NUMERICHOSTflag then the node parameter must be a numerical network address.
TheAI_NUMERICHOSTflag suppresses any potentially lengthy network host address lookups.
"""Ah! Learned something new today. So what's the specific advantage of using
getnameinfo()instead ofinet_ntop()instead?(I've only ever used
getnameinfo()if I really wanted to do DNS lookups).Quoted 5 lines
Quoted 2 lines
Now we enter religious
territory - *I* think that this is not a good thing.I can't more eagerly _agree_ on tossing out any reverse DNS lookups at this level.
OK, good. Glad that this was just a misreading of the code.
Quoted 7 lines
Quoted 6 lines
The existing
code doesn't do reverse DNS lookups for IPv4 mroute printing, and so the IPv6 code should behave similar to the IPv4 code, and not do DNS either (also, depending on DNS lookup in this place might lead to weird delays in unexpected situations). But this is partly religious, partly "follow the coding style of the existing code" stuff.
Quoted 6 lines
Quoted 2 lines
IMO we should void using
inet_ntop()and friends, personally I don't like locking around their lack of multi-threading.Mmmh, ok. I wasn't aware that
inet_ntop()is not thread-safe. (Looking at the FreeBSD implementation, at least that one *is* thread-safe - no static buffers, etc.).
And now I learned something new, by *actually* closely looking inet_ntop() manpage, heh (had a totally wrong braino on it using static buffers).
Please just ignore this non MT-safe state from me.
Quoted 17 lines
If it is not thread-safe, it won't break anything in my code, though (lucky me :-) ) - my use of it in
print_in6_addr()is mutex-locked anyway, due to the use of a static buffer there.Is
getnameinfo()*guaranteed* to be thread-safe?Do you have a reference that documents that
inet_ntop()andinet_pton()are unsave to be used in a threaded context?gert
--
USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'
Quoted 21 lines · David Sommerseth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi guys!
Quoted 1 line · JuanJo Ciarlante
On Wed, Feb 17, 2010 at 6:46 PM, JuanJo Ciarlante <[email protected]...>
Quoted 5 lines · wrote:
Quoted 4 lines
I still need to do some touches for allmerged, as we conflict w/ Gert's IPv6 patch on a
mroute.cchunk IIRC.Even though I know you both have told me that there would be a merge conflict in
mroute.c, I decided to put it on the mailing list - hopefully to get an open discussion about it!I've attached the merge conflict. It would be great if you could sort this out soon. Then I'll get both of your trees into the allmerged branch ASAP. Right now only Gert's code is in the allmerged branch.
Quoted 8 lines
What I do see might be a challenge (without knowing the code in details), is that JJO's code is using #ifdef, while Gert's code is not. With a conflict in
mroute_addr_print_ex(), which includes an #ifdef I see a potential disaster here.Personally, I would like to evaluate Gert's patches to see if they could be #ifdef'ed. Then both IPv6 branches can both use
USE_PF_INET6to enable or disable the IPv6 support.
IMHO they should have different #ifdef'ing, coming from eg:
../configure --enable-ipv6-transport --enable-ipv6-payload
, mainly to ease future debugging, and to motivate wider audience thinking of:
* different OSes (ipv6-transport builds and (probably)runs in windowze)
* distros like Gentoo, already carrying ipv6-transport, may want to add a build option for the payload patch.
* size constraints (embeeded like eg. freetz.org)
* USE_PF_INET6 clearly speaks "transport" in its very name :)
Quoted 18 lines
I have not studied these patches,
so I don't know how doable that is. And this is my personal opinion, I don't mean to instruct anyone into a direction. I will let you guys find the proper direction.kind regards,
David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/iEYEARECAAYFAkt+caIACgkQDC186MBRfrr5ZACgqLxiXN70pCOGY0zyvQGSCpo6 n2EAn1le6hzZe4aThLfAKvYwK7d3CPSG
=e7yX
-----END PGP SIGNATURE-----
Signature · 1 line
--JuanJo ; echo [email protected]... | sed 's/[SPAM]//g'