1package Net::DNS::Check::Test::host_ip_private; 2 3use strict; 4use vars qw(@ISA $VERSION); 5 6@ISA = qw(Net::DNS::Check::Test); 7 8sub new { 9 my ($class) = shift; 10 11 my ($self) = bless {}, $class; 12 13 if ( @_ ) { 14 $self->_process_args(@_); 15 } 16 17 $self->test(); 18 19 return $self; 20} 21 22 23sub test() { 24 my ($self) = shift; 25 26 $self->{test_status} = 1; 27 $self->{test_detail} = {}; 28 29 foreach my $nsquery ( @{$self->{nsquery}} ) { 30 $self->_check_host( $nsquery->hostslist(), $nsquery->ns_name() ); 31 } 32 33 $self->_check_host( $self->{hostslist} ); 34 35 return $self->{test_status}; 36} 37 38 39 40sub _check_host() { 41 my ($self) = shift; 42 my $hostslist = shift; 43 my $source = shift || 'Recursion'; 44 45 return unless ( $hostslist ); 46 47 foreach my $hostname ( $hostslist->get_list() ) { 48 my $host = $hostslist->get_host($hostname); 49 50 foreach my $ip_priv ( @{$self->{config}->ip_private()} ) { 51 foreach my $ip ( @{$host->get_ip()} ) { 52 $self->{test_detail}->{$source}->{$hostname}->{$ip}->{desc} = $ip; 53 if ( $ip =~ /^$ip_priv\S+$/ ) { 54 $self->{test_detail}->{$source}->{$hostname}->{$ip}->{status} = 0; 55 $self->{test_status} = 0; 56 } else { 57 $self->{test_detail}->{$source}->{$hostname}->{$ip}->{status} = 1; 58 } 59 } 60 } 61 } 62} 63 64 651; 66 67__END__ 68 69=head1 NAME 70 71Net::DNS::Check::Test::host_ip_private - Check if the IP addresses found during the hosts resolution do not belong to IP private classes 72 73=head1 SYNOPSIS 74 75C<use Net::DNS::Check::Test::host_ip_vs_ip_orig>; 76 77=head1 DESCRIPTION 78 79Check if the IP addresses found during the hosts resolution do not belong to IP private classes. 80 81Due to a differnt internal structure, at present this is the only test that doesn't report detailed information about results of the single analisys for every nameserver. You can only know if the test fails or not. 82 83=head1 METHODS 84 85=head1 COPYRIGHT 86 87Copyright (c) 2005 Lorenzo Luconi Trombacchi - IIT-CNR 88 89All rights reserved. This program is free software; you may redistribute 90it and/or modify it under the same terms as Perl itself. 91 92=head1 SEE ALSO 93 94L<perl(1)> 95 96=cut 97 98