[erlang-bugs] Re: ODBC and net.ipv6.bindv6only

Ingela Anderton Andin <>
Thu Oct 28 17:23:55 CEST 2010


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 

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
> <> 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:

More information about the erlang-bugs mailing list