Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  ODBC and net.ipv6.bindv6only

Guest
Posted: Fri Oct 29, 2010 6:42 am Reply with quote
Guest
Hi again!

After loking into this bug more closely I've found that the disabled
code (only for UNIX) does the following: it resolves "localhost" for
all available IP-addresses (IPv4 and IPv6) and tries to connect to all
of them sequentially (to the first success).

The problem is that localhost may have only IPv4 IP-address associated
with. In this case enabling IPv6 code will not fix the bug (though a
local admin will be able to fix it himself by adding ::1 localhost to
/etc/hosts).

So, I'm suggesting the following:

1) prefer IPv4 in odbc:init/1 instead of IPv6. This makes sure that in
all current environments ODBC will work (I'm not aware of anyone who
has IPv4 disabled other that for testing).

2) enable IPv6 capable code in odbcserver.c, which will make things
working if IPv6 is the only protocol (in this case it's very likely
that localhost resolves into ::1 and doesn't require special
attention).

I'm attaching a simple patch which does the above changes.

On Mon, Oct 18, 2010 at 12:27 PM, Ingela Anderton Andin
<ingela@erix.ericsson.se> wrote:
> Hi!
>
> I think it should be fairly safe to enable it, I am sure we had a good
> reason
> for doing this once upon a time but
Guest
Posted: Fri Oct 29, 2010 6:42 am Reply with quote
Guest
Hi!

We decided not to solve it that way, as this code was written a long
time ago when
things where different from now, we decided on enabling ipv6 on windows and
using loopback address constants to connect avoiding localhost resolution.
I think this should work, will be available at github in the begining of
next week
if our tests goes well on all platforms. (Only tested on linux at the
moment).

Regards Ingela Erlang/OTP team - Ericsson AB

Sergei Golovan wrote:
> Hi again!
>
> After loking into this bug more closely I've found that the disabled
> code (only for UNIX) does the following: it resolves "localhost" for
> all available IP-addresses (IPv4 and IPv6) and tries to connect to all
> of them sequentially (to the first success).
>
> The problem is that localhost may have only IPv4 IP-address associated
> with. In this case enabling IPv6 code will not fix the bug (though a
> local admin will be able to fix it himself by adding ::1 localhost to
> /etc/hosts).
>
> So, I'm suggesting the following:
>
> 1) prefer IPv4 in odbc:init/1 instead of IPv6. This makes sure that in
> all current environments ODBC will work (I'm not aware of anyone who
> has IPv4 disabled other that for testing).
>
> 2) enable IPv6 capable code in odbcserver.c, which will make things
> working if IPv6 is the only protocol (in this case it's very likely
> that localhost resolves into ::1 and doesn't require special
> attention).
>
> I'm attaching a simple patch which does the above changes.
>
> On Mon, Oct 18, 2010 at 12:27 PM, Ingela Anderton Andin
> <ingela@erix.ericsson.se> wrote:
>
>> Hi!
>>
>> I think it should be fairly safe to enable it, I am sure we had a good
>> reason
>> for doing this once upon a time but now it feels somewhat strange to
>> have that hardcode and it does not agree with the rest of the code.
>> I will try removing it and see what happens.
>>
>> Regards Ingela Erlang/OTP team -Ericsson AB
>>
>> Sergei Golovan wrote:
>>
>>> Hi again!
>>>
>>> It seems I've found why odbc doesn't work in IPv6-IPv4 environment when
>>> IPv6
>>> sockets don't bind to IPv4 also. In odbcserver.c code I've found the
>>> following:
>>>
>>> #define USE_IPV4
>>> #ifdef UNIX
>>> #define SOCKET int
>>> #endif
>>>
>>> #if defined WIN32 || defined USE_IPV4
>>> /* Currently only an old windows compiler is supported so we do not have
>>> ipv6
>>> capabilities */
>>> static SOCKET connect_to_erlang(const char *port)
>>> {
>>>
>>> So, IPv6 capable code is just switched off. Is it safe to enable it?
>>> (Only connect_to_erlang function will change.)
>>>
>>> Cheers!
>>>
>>>
>>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> ________________________________________________________________
> erlang-bugs (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org


________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Fri Oct 29, 2010 7:02 am Reply with quote
Guest
On Thu, Oct 28, 2010 at 7:23 PM, Ingela Anderton Andin
<ingela@erix.ericsson.se> wrote:
> Hi!
>
> We decided not to solve it that way, as this code was written

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum