[#59] Arpnip tries to resolve link local IPv6 addresses
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
* [#82] Check /etc/hosts before DNS when doing arp entry name lookup
|
* [#82] Check /etc/hosts before DNS when doing arp entry name lookup
|
||||||
|
* [#59] Arpnip tries to resolve link local IPv6 addresses
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -761,12 +761,18 @@ Value: Settings Tree. Default:
|
|||||||
|
|
||||||
dns:
|
dns:
|
||||||
max_outstanding: 250
|
max_outstanding: 250
|
||||||
|
no: ['fe80::/64','169.254.0.0/16']
|
||||||
|
|
||||||
Sets the maximum number of outstanding requests for asynchronous DNS
|
Controls the asynchronous DNS resolver used to resolve IP addresses to
|
||||||
resolution used during arpnip and device alias discovery.
|
names during arpnip and discovery of device aliases.
|
||||||
|
|
||||||
This setting overrides the C<PERL_ANYEVENT_MAX_OUTSTANDING_DNS> environment
|
C<max_outstanding> sets the maximum number of outstanding requests for
|
||||||
value and the C<AnyEvent> library default of 10.
|
asynchronous DNS resolution. This setting overrides the
|
||||||
|
C<PERL_ANYEVENT_MAX_OUTSTANDING_DNS> environment value and the C<AnyEvent>
|
||||||
|
library default of 10.
|
||||||
|
|
||||||
|
C<no> is a list of IP addresses or CIDR ranges to excluded from DNS
|
||||||
|
resolution. Link local addresses are excluded by default.
|
||||||
|
|
||||||
=head3 C<housekeeping>
|
=head3 C<housekeeping>
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package App::Netdisco::Util::DNS;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
|
|
||||||
|
use Dancer ':script';
|
||||||
use Net::DNS;
|
use Net::DNS;
|
||||||
use AnyEvent::DNS::EtcHosts;
|
use AnyEvent::DNS::EtcHosts;
|
||||||
use AnyEvent::DNS;
|
use AnyEvent::DNS;
|
||||||
|
use NetAddr::IP::Lite ':lower';
|
||||||
|
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
@@ -104,6 +106,7 @@ sub hostnames_resolve_async {
|
|||||||
|
|
||||||
foreach my $hash_ref (@$ips) {
|
foreach my $hash_ref (@$ips) {
|
||||||
my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'};
|
my $ip = $hash_ref->{'ip'} || $hash_ref->{'alias'};
|
||||||
|
next if no_resolve($ip);
|
||||||
$done->begin;
|
$done->begin;
|
||||||
AnyEvent::DNS::reverse_verify $ip,
|
AnyEvent::DNS::reverse_verify $ip,
|
||||||
sub { $hash_ref->{'dns'} = shift; $done->end; };
|
sub { $hash_ref->{'dns'} = shift; $done->end; };
|
||||||
@@ -118,5 +121,30 @@ sub hostnames_resolve_async {
|
|||||||
return $ips;
|
return $ips;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head2 no_resolve( $ip )
|
||||||
|
|
||||||
|
Given an IP address, returns true if excluded from DNS resolution by the
|
||||||
|
C<dns_no> configuration directive, otherwise returns false.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub no_resolve {
|
||||||
|
my $ip = shift;
|
||||||
|
|
||||||
|
my $config = setting('dns')->{no} || [];
|
||||||
|
return 0 if not scalar @$config;
|
||||||
|
|
||||||
|
my $addr = NetAddr::IP::Lite->new($ip);
|
||||||
|
|
||||||
|
foreach my $item (@$config) {
|
||||||
|
my $c_ip = NetAddr::IP::Lite->new($item)
|
||||||
|
or next;
|
||||||
|
next unless $c_ip->bits == $addr->bits;
|
||||||
|
|
||||||
|
return 1 if ($c_ip->contains($addr));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ workers:
|
|||||||
|
|
||||||
dns:
|
dns:
|
||||||
max_outstanding: 250
|
max_outstanding: 250
|
||||||
|
no: ['fe80::/64','169.254.0.0/16']
|
||||||
|
|
||||||
#housekeeping:
|
#housekeeping:
|
||||||
# discoverall:
|
# discoverall:
|
||||||
|
|||||||
Reference in New Issue
Block a user