1package Net::DNS::Check::Test::host_ip_vs_ip_orig; 2 3use strict; 4use vars qw(@ISA $VERSION); 5 6@ISA = qw(Net::DNS::Check::Test); 7 8 9sub new { 10 my ($class) = shift; 11 12 my ($self) = bless {}, $class; 13 14 if ( @_ ) { 15 $self->_process_args(@_); 16 } 17 18 $self->test(); 19 20 return $self; 21} 22 23 24 25sub test() { 26 my ($self) = shift; 27 28 my $test_status = 1; 29 my @host_array; 30 my $test_detail = {}; 31 32 33 # Local hostslist 34 foreach my $nsquery ( @{$self->{nsquery}} ) { 35 foreach my $host ( $nsquery->hostslist()->get_list() ) { 36 push ( @host_array, $nsquery->hostslist()->get_host($host) ); 37 } 38 } 39 40 # Gnereal Hostslist 41 foreach my $host ( $self->{hostslist}->get_list() ) { 42 push ( @host_array, $self->{hostslist}->get_host($host) ); 43 } 44 45 46 47 foreach my $host ( @host_array ) { 48 49 my $hostname = $host->get_hostname(); 50 # next if ( exists $test_detail->{$hostname} ); 51 52# print "$hostname: "; 53 54 my $ip_orig = join('|', sort @{$host->get_ip_orig()}); 55 next unless ( $ip_orig ); 56 my $ip = join('|', sort @{$host->get_ip()}); 57 58 print "$ip vs $ip_orig\n"; 59 60 if ( $ip eq $ip_orig ) { 61 $test_detail->{$hostname}->{status} = 1; 62 $test_detail->{$hostname}->{desc} = join(' ', sort @{$host->get_ip()}); 63 } else { 64 $test_detail->{$hostname}->{status} = 0; 65 66 if ( $host->error() ) { 67 $test_detail->{$hostname}->{desc} = $host->{error}; 68 } else { 69 $test_detail->{$hostname}->{desc} = join(' ', sort @{$host->get_ip_orig()}) . ' vs ' . join(' ', sort @{$host->get_ip()}); 70 } 71 72 $test_status = 0; 73 } 74 75 } 76 77 $self->{test_status} = $test_status; 78 $self->{test_detail} = $test_detail; 79 80 return $test_status; 81} 82 831; 84 85__END__ 86 87=head1 NAME 88 89Net::DNS::Check::Test::host_ip_vs_ip_orig - Compare the IP addresses found during the hosts resolution with the IP addresses given with nserver argument (if exists) in method "new". 90 91=head1 SYNOPSIS 92 93C<use Net::DNS::Check::Test::host_ip_vs_ip_orig>; 94 95=head1 DESCRIPTION 96 97Compare the IP addresses found during the hosts resolution with the IP addresses given with nserver argument (if exists) in method "new". 98=head1 METHODS 99 100=head1 COPYRIGHT 101 102Copyright (c) 2005 Lorenzo Luconi Trombacchi - IIT-CNR 103 104All rights reserved. This program is free software; you may redistribute 105it and/or modify it under the same terms as Perl itself. 106 107=head1 SEE ALSO 108 109L<perl(1)> 110 111=cut 112 113