AnyEvent resolves hostnames always via DNS
Piotr Roszatycki
piotr.roszatycki at gmail.com
Tue Mar 6 20:04:03 CET 2012
Hi.
Yesterday I noticed, that AnyEvent::Socket::resolve_sockaddr works
different than on every Linux box
and it lookups DNS even if address is in /etc/hosts.
The most default configuration of Name Service Switch:
$ grep hosts /etc/nsswitch.conf
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
The order of resolving a socket address is important because
/etc/hosts works even if i.e. nameserver is unavailable (problem with
network or DNS itself, firewalled intranet, etc.). It also makes a
possible local overring (spoofing) some addresses outside our network.
AnyEvent works differently: it uses DNS even if address is already
found in /etc/hosts. AnyEvent::DNS reads /etc/resolv.conf and uses its
options so I think /etc/nsswitch.conf might honor it too. At least
some $ENV{PERL_ANYEVENT_*} settings could disable mandatory DNS
lookup.
Is it possible to change the default AnyEvent's behavior and make some
applications working without DNS?
Thanks.
--
.''`. Piotr Roszatycki
: :' : mailto:Piotr.Roszatycki at gmail.com
`. `' mailto:dexter at cpan.org
`-
More information about the anyevent
mailing list