Patch for DNS over IPv6 support

Sergei Golovan <>
Sat Aug 1 15:35:28 CEST 2009


Appears that Erlang doesn't use DNS servers over IPv6. It ignores
nameserver directive in /etc/resolv.conf if the IP it specifies is an
IPv6 address and directly uses inet_udp and inet_tcp when connecting
to DNS server (module inet_res).

The problem is that if for some reason /etc/resolv.conf doesn't
contain IPv4 nameservers the Erlang resolver doesn't work (see bug in Debian
bugtracker). This situation isn't common now, but will be more and
more common in the future.

The attached patch adds transparent IPv6 support to inet_res module.
It means that in case when nameserver IP address is an IPv4 address
then it will be queried over IPv4, if it is an IPv6 address then it
will be queried over IPv6. There is one drawback though: in case of
DNS over UDP instead of opening a single socket and using it for
queries to all nameservers the patched version opens one socket per
DNS query. This may slightly decrease performance in case of many DNS
servers in /etc/resolv.conf.

Sergei Golovan

More information about the erlang-patches mailing list