[erlang-bugs] : : : inet_res:getbyname

Raimo Niskanen raimo+erlang-bugs@REDACTED
Mon Sep 10 09:45:20 CEST 2007


Well, it is deprecated for A and AAAA lookups since it was
impossible to make it behave like the native resolver on all
platforms. For DNS lookups where you really want just a DNS
lookup it is still needed, so we can not remove it and
have to fix bugs in it.

In other words: it is and will be maintained.

That it only works in conjunction with the -name option
I also regard as a bug, but behaviour in this area has always
been very sensitive to change, so improving this might
break code for paying customers.

I will try to investigate the possibility to always read
/etc/resolv.conf on all Unixes to set up inet_res. That does
not sound like a too dangerous change for R12, but I do not
have the final word here...

The workaround below does work, but that function is on the
"possible to remove" list. Another more supported way of
doing exactly the same thing is to create a file e.g
"~/.inetrc" containing:
---------------cut
{file,resolv,"/etc/resolv.conf"}.
---------------cut
and then either set the environment variable
ERL_INETRC="~/.inetrc"
or, set the Erlang kernel application parameter "inetrc" to
the same filename either on the command line like this:
$ erl -kernel inetrc "\"~/.inetrc\""
or in the Erlang start script (I have never done it).



On Sat, Sep 08, 2007 at 11:41:37AM +0200, Mikael Magnusson wrote:
> Matthew O'Gorman wrote:
> > Exactly, I do want to do a dns query on the srv, currently the only
> > way i know to do that is using inet_res, which is deprecated and
> > broken for everything but -name, if there is to be a replacement or
> > there is another way to make it work I would appreciate knowing it.
> > 
> > Mog
> 
> I'm able to use inet_res also on nodes with short names (-sname) if I 
> call inet_db:add_resolv:
> 
>      inet_db:add_resolv("/etc/resolv.conf").
> 
> Btw, why not always use long node names (-name)?
> 
> Mikael
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-bugs

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-bugs mailing list