[erlang-bugs] Re: ODBC and net.ipv6.bindv6only
Sergei Golovan
sgolovan@REDACTED
Wed Oct 27 08:06:33 CEST 2010
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@REDACTED> 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!
>>
>
>
--
Sergei Golovan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odbc.patch
Type: application/octet-stream
Size: 814 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20101027/219f3661/attachment.obj>
More information about the erlang-bugs
mailing list