Changeset 360
- Timestamp:
- Sep 14, 2018, 9:48:42 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ddt/ddt
r359 r360 2727 2727 my $ip_address = inet_ntoa($packed_ip); 2728 2728 if ($ip ne $ip_address) { 2729 print "Error: bad IP for reverse DNS on $dns_hostname_fq / $ip\n";2729 print "Error: bad IP $ip for reverse DNS on $dns_hostname_fq\n"; 2730 2730 next LOOP_ON_COMPUTER; 2731 2731 } … … 2761 2761 my @ip_check; 2762 2762 LOOP_ON_SECTOR: 2763 for my $sector_current ( @{$computer_db->{'dset'}}) {2764 next LOOP_ON_SECTOR if not exists $computer_db->{'dset'}{ 'ip_range'};2763 for my $sector_current (keys %{$computer_db->{'dset'}}) { 2764 next LOOP_ON_SECTOR if not exists $computer_db->{'dset'}{$sector_current}{'ip_range'}; 2765 2765 2766 2766 LOOP_ON_CIDR: 2767 for my $ip_range (@{$computer_db->{'dset'}{ 'ip_range'}}) {2767 for my $ip_range (@{$computer_db->{'dset'}{$sector_current}{'ip_range'}}) { 2768 2768 2769 2769 LOOP_ON_IP: 2770 2770 for my $ip (NetAddr::IP->new($ip_range)->hostenum()) { 2771 2771 print "$ip\n"; 2772 2773 my $dns_hostname_fq = scalar gethostbyaddr(inet_aton($ip), AF_INET); 2774 my ($dns_hostname) = split /\./, $dns_hostname_fq; 2775 2776 # Verify reverse return same IP 2777 my $packed_ip = scalar gethostbyname($dns_hostname_fq); 2778 if (defined $packed_ip) { 2779 my $ip_address = inet_ntoa($packed_ip); 2780 if ($ip ne $ip_address) { 2781 print "Error: bad IP $ip for reverse DNS on $dns_hostname_fq\n"; 2782 #next LOOP_ON_IP; 2783 } 2784 } 2785 2786 # Verify direct return same host 2787 LOOP_ON_COMPUTER: 2788 for my $computer (@{$computer_db->{$sector_current}) { 2789 my ($mac_address, $attribute) = %{$computer}; 2790 2791 next LOOP_ON_COMPUTER if $attribute->{'ip'} ne $ip; 2792 2793 next LOOP_ON_IP if $attribute->{'hostname'} eq $dns_hostname; 2794 2795 print "Error: DNS bad host $dns_hostname for IP $ip\n"; 2796 next LOOP_ON_IP; 2797 } 2798 2799 # Declare in DNS but not in DDT 2800 print "Error: DNS host $dns_hostname with IP $ip not declare in DDT database\n" if $dns_hostname ne ''; 2801 # Normally never arrive here 2802 2803 #if ($computer_db->{$sector_current}{}$attribute->{'hostname'} ne $dns_hostname) { 2804 # print "$mac_address ($sector_current) $ip - $dns_hostname / $attribute->{'hostname'} # $attribute->{'comment'}\n"; 2805 # next LOOP_ON_IP; 2806 # } 2772 2807 } 2773 2808 }
Note: See TracChangeset
for help on using the changeset viewer.