Permalink
Browse files

Now we test nameserver IPv6 addresses as well. When fpdns is given

a hostname to probe, it will test both its IPv4 and IPv6 addresses
if the name has both A and AAAA records.  Also true for the -D option.

For most dual-stack name servers, this probably means we test it
twice.  However, sometimes the two addresses will be on different
servers or at least different processes, so the fingerprint might be
different.
  • Loading branch information...
1 parent 84eaefe commit d48b141165d9422c18d0e27c46b306b3d6f722a3 @wessels wessels committed Apr 20, 2012
Showing with 16 additions and 4 deletions.
  1. +16 −4 apps/fpdns
View
@@ -128,21 +128,27 @@ sub dnslookup {
return $arg if ($arg =~ $IPv4RE);
return $arg if ($arg =~ $IPv6RE);
- my $resolver =
- Net::DNS::Resolver->new(usevc => $opt{T});
+ my $resolver = Net::DNS::Resolver->new(usevc => $opt{T});
$resolver->srcaddr($opt{Q}) if $opt{Q};
if ($opt{D}) {
my $query = $resolver->send($arg, "NS");
if ($query) {
for my $rr ($query->answer) {
- my $query_address = $resolver->send($rr->rdatastr, "A")
- if $rr->type eq "NS";
+ next unless $rr->type eq "NS";
+ my $query_address = $resolver->send($rr->rdatastr, "A");
if ($query_address) {
for my $address_rr ($query_address->answer) {
push @addresses, $address_rr->address
if $address_rr->type eq "A";
}
}
+ $query_address = $resolver->send($rr->rdatastr, "AAAA");
+ if ($query_address) {
+ for my $address_rr ($query_address->answer) {
+ push @addresses, $address_rr->address
+ if $address_rr->type eq "AAAA";
+ }
+ }
}
}
} else {
@@ -152,6 +158,12 @@ sub dnslookup {
push @addresses, $rr->address if $rr->type eq "A";
}
}
+ $query = $resolver->send($arg, "AAAA");
+ if ($query) {
+ for my $rr ($query->answer) {
+ push @addresses, $rr->address if $rr->type eq "AAAA";
+ }
+ }
}
return @addresses;

0 comments on commit d48b141

Please sign in to comment.