#320 DNS subroutines are redefined
This commit is contained in:
@@ -66,6 +66,22 @@ if (exists setting('workers')->{interactives}
|
||||
setting('dns')->{hosts_file} ||= '/etc/hosts';
|
||||
setting('dns')->{no} ||= ['fe80::/64','169.254.0.0/16'];
|
||||
|
||||
# load /etc/hosts
|
||||
setting('dns')->{'ETCHOSTS'} = {};
|
||||
{
|
||||
# AE::DNS::EtcHosts only works for A/AAAA/SRV, but we want PTR.
|
||||
# this loads+parses /etc/hosts file using AE. dirty hack.
|
||||
use AnyEvent::Socket 'format_address';
|
||||
use AnyEvent::DNS::EtcHosts;
|
||||
AnyEvent::DNS::EtcHosts::_load_hosts_unless(sub{},AE::cv);
|
||||
no AnyEvent::DNS::EtcHosts; # unimport
|
||||
|
||||
setting('dns')->{'ETCHOSTS'}->{$_} =
|
||||
[ map { [ $_ ? (format_address $_->[0]) : '' ] }
|
||||
@{ $AnyEvent::DNS::EtcHosts::HOSTS{ $_ } } ]
|
||||
for keys %AnyEvent::DNS::EtcHosts::HOSTS;
|
||||
}
|
||||
|
||||
# support unordered dictionary as if it were a single item list
|
||||
if (ref {} eq ref setting('device_identity')) {
|
||||
config->{'device_identity'} = [ setting('device_identity') ];
|
||||
|
||||
Reference in New Issue
Block a user