Index: /trunk/ddt/ddt
===================================================================
--- /trunk/ddt/ddt	(revision 341)
+++ /trunk/ddt/ddt	(revision 342)
@@ -2613,5 +2613,5 @@
 
    GetOptions(
-      'Direct|D'  => \$opt_direct,
+      'direct|d'  => \$opt_direct,
       'reverse|r' => \$opt_reverse,
       );
@@ -2619,43 +2619,44 @@
    my $computer_db = ipamdb_load($COMPUTER_YAML);
 
-   LOOP_ON_DOMAINSET:
-   for my $domainset_current (keys %{$computer_db}) {
-      last LOOP_ON_DOMAINSET if $opt_direct;    # No DDT to DNS check
-      next if $domainset_current eq 'dset';
-      next if $domainset_current eq 'pool';
-      next if $domainset_current eq 'pxe';
-      next if $domainset_current eq 'tag';
-      next if $domainset_current eq 'version';
-
-      my @domainsetdb = @{$computer_db->{$domainset_current}};
-
-      LOOP_ON_COMPUTER:
-      for my $computer (@domainsetdb) {
-         my ($mac_address, $attribute) = %{$computer};
-         #my $new_mac = normalize_mac_address($mac_address);
-         my $ip = $attribute->{'ip'};
-         next LOOP_ON_COMPUTER if not $ip =~ m/$DDT::RE::IPv4_ADDRESS/xms;
-         next LOOP_ON_COMPUTER if $attribute->{'enabled'} eq 'no';
-
-         my $dns_hostname_fq = scalar gethostbyaddr(inet_aton($ip), AF_INET);
-         my ($dns_hostname) = split /\./, $dns_hostname_fq;
-
-         if ($attribute->{'hostname'} ne $dns_hostname) {
-            print "$mac_address ($domainset_current) $ip - $dns_hostname / $attribute->{'hostname'} # $attribute->{'comment'}\n";
-            next LOOP_ON_COMPUTER;
-            }
-
-         my $packed_ip = scalar gethostbyname($dns_hostname_fq);
-         if (defined $packed_ip) {
-            my $ip_address = inet_ntoa($packed_ip);
-            if ($ip ne $ip_address) {
-               print "reverse DNS error for $dns_hostname_fq / $ip\n";
+   if ($opt_direct or not $opt_reverse) { # DDT to DNS check
+      LOOP_ON_DOMAINSET:
+      for my $domainset_current (keys %{$computer_db}) {
+         next if $domainset_current eq 'dset';
+         next if $domainset_current eq 'pool';
+         next if $domainset_current eq 'pxe';
+         next if $domainset_current eq 'tag';
+         next if $domainset_current eq 'version';
+
+         my @domainsetdb = @{$computer_db->{$domainset_current}};
+
+         LOOP_ON_COMPUTER:
+         for my $computer (@domainsetdb) {
+            my ($mac_address, $attribute) = %{$computer};
+            #my $new_mac = normalize_mac_address($mac_address);
+            my $ip = $attribute->{'ip'};
+            next LOOP_ON_COMPUTER if not $ip =~ m/$DDT::RE::IPv4_ADDRESS/xms;
+            next LOOP_ON_COMPUTER if $attribute->{'enabled'} eq 'no';
+
+            my $dns_hostname_fq = scalar gethostbyaddr(inet_aton($ip), AF_INET);
+            my ($dns_hostname) = split /\./, $dns_hostname_fq;
+
+            if ($attribute->{'hostname'} ne $dns_hostname) {
+               print "$mac_address ($domainset_current) $ip - $dns_hostname / $attribute->{'hostname'} # $attribute->{'comment'}\n";
                next LOOP_ON_COMPUTER;
                }
-            }
-         }
-      }
-
-   if ($opt_reverse) {  # No DNS to DDT check
+
+            my $packed_ip = scalar gethostbyname($dns_hostname_fq);
+            if (defined $packed_ip) {
+               my $ip_address = inet_ntoa($packed_ip);
+               if ($ip ne $ip_address) {
+                  print "Error: bad IP for reverse DNS on $dns_hostname_fq / $ip\n";
+                  next LOOP_ON_COMPUTER;
+                  }
+               }
+            }
+         }
+      }
+
+   if ($opt_reverse) {  # DNS to DDT check
       my %saw; # count for unique member
       my @dns_domain_list = sort grep !$saw{$_}++,
@@ -3149,5 +3150,5 @@
  ddt change-mac [--hostname|-h hostname] [--domainset|-d domainset] [--ip|-i ip] [--mac|-m mac]
  ddt change-tag [--hostname|-h hostname] [--domainset|-d domainset] [--ip|-i ip] [--mac|-m mac] [--tag|-t tag]
- ddt check-dns [--Direct] [--reverse]
+ ddt check-dns [--direct] [--reverse]
  ddt create-domainset [--domainset|-d domainset] [--dns-extension|-e dns_extension] [--comment|-c comment]
  ddt create-pool [--pool|-p pool] [--domainset|-d domainset] [--file-pool|-f file_pool] [--ipaddress-pool|-i ipaddress_pool]
@@ -3243,5 +3244,5 @@
  ddt change-mac [--hostname|-h hostname] [--domainset|-d domainset] [--ip|-i ip] [--mac|-m mac]
  ddt change-tag [--hostname|-h hostname] [--domainset|-d domainset] [--ip|-i ip] [--mac|-m mac] [--tag|-t tag]
- ddt check-dns [--Direct] [--reverse]
+ ddt check-dns [--direct] [--reverse]
  ddt create-domainset [--domainset|-d domainset] [--dns-extension|-e dns_extension] [--comment|-c comment]
  ddt create-pool [--pool|-p pool] [--domainset|-d domainset] [--file-pool|-f file_pool] [--ipaddress-pool|-i ipaddress_pool]
@@ -3332,5 +3333,5 @@
 =head2 check-dns
 
- ddt check-dns [--Direct] [--reverse]
+ ddt check-dns [--direct] [--reverse]
 
 =head2 create-domainset
