Quantcast

[erlang-questions] IPv6 support in inet_gethost

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[erlang-questions] IPv6 support in inet_gethost

Sergei Golovan-2
Hi!

As far as I understand, inet_gethost uses getipnodebyname and
getipnodebyaddr functions.

It seems that both functions aren't implemented in Linux (probably
they require some unusual libraries?).

Mikael Magnusson has sent a patch (attached, patch is for R11B-2) to
Debian bugs database. It adds IPv6 addresses resolution using
gethostbyname2 and gethostbyaddr.

I hope it will be useful not only for Debian users.

Best wishes!
--
Sergei Golovan

_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions

otp_gethostbyname2_in6_addr.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [erlang-questions] IPv6 support in inet_gethost

Jani Hakala
"Sergei Golovan" <[hidden email]> writes:

> Hi!
>
> As far as I understand, inet_gethost uses getipnodebyname and
> getipnodebyaddr functions.
>
> It seems that both functions aren't implemented in Linux (probably
> they require some unusual libraries?).
>
The man page says that
 "These functions are deprecated. Use getaddrinfo(3)  and getnameinfo(3)
  instead."

 "NOTES
    These functions have been present in glibc 2.1.91-95, but were removed
    again. Several Unix-like systems support them, but all call them
    deprecated."

> Mikael Magnusson has sent a patch (attached, patch is for R11B-2) to
> Debian bugs database. It adds IPv6 addresses resolution using
> gethostbyname2 and gethostbyaddr.
>
gethostbyname2 is a GNU extension.

> I hope it will be useful not only for Debian users.
>
Using getaddrinfo and getnameinfo might be a better idea then?

Jani Hakala
_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [erlang-questions] IPv6 support in inet_gethost

Fredrik Thulin
Jani Hakala wrote:
...
>> I hope it will be useful not only for Debian users.
>>
> Using getaddrinfo and getnameinfo might be a better idea then?

Surely. My colleague Love Hörnquist Åstrand wrote such a patch once, but
   it could never be accepted by the OTP group because with getaddrinfo
you  don't get the same hostent aliases as you do with gethostbyname.

This broke the Ericsson test suite for NIS on Solaris (or something
equally yucky), and as far as I know no progress was ever made.

A workaround is to issue these two commands to make your Erlang node use
the good ol' native Erlang resolver :

   ets:insert(inet_db, {res_ns, [{{127, 0, 0, 1}, 53}]}).
   ets:insert(inet_db, {res_lookup, [dns]}).

Substitute {127, 0, 0, 1} with the address of your resolver - I don't
know if it works with an IPv6 tuple.

/Fredrik

_______________________________________________
erlang-questions mailing list
[hidden email]
http://www.erlang.org/mailman/listinfo/erlang-questions
Loading...