Code

Remove Net::DNS in favor of socket.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 10:31:22 +0000 (10:31 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 10:31:22 +0000 (10:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9160 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/ArpHandler.pm

index d81ef57d5a6db68d02f95300da152236053c6ec7..fec419de2e9cb68520eaa87c6576b3703ca87dde 100644 (file)
@@ -14,6 +14,7 @@ use Net::LDAP::Entry;
 use Net::DNS;
 use Switch;
 use Data::Dumper;
+use Socket;
 use utf8;
 
 # Don't start if some of the modules are missing
@@ -36,7 +37,6 @@ END{}
 my ($timeout, $mailto, $mailfrom, $user, $group);
 my ($arp_enabled, $arp_interface, $ldap_uri, $ldap_base, $ldap_admin_dn, $ldap_admin_password);
 my $hosts_database={};
-my $resolver=Net::DNS::Resolver->new;
 my $ldap;
 
 my %cfg_defaults =
@@ -179,8 +179,7 @@ sub got_packet {
        my $capture_device = sprintf "%s", $kernel->alias_list($sender) =~ /^arp_watch_(.*)$/;
 
        if(!exists($hosts_database->{$packet->{source_haddr}})) {
-               my $dnsresult= $resolver->search($packet->{source_ipaddr});
-               my $dnsname= (defined($dnsresult))?$dnsresult->{answer}[0]->{ptrdname}:$packet->{source_ipaddr};
+               my $dnsname= gethostbyaddr(inet_aton($packet->{source_ipaddr}), AF_INET) || $packet->{source_ipaddr};
                my $ldap_result=&get_host_from_ldap($packet->{source_haddr});
                if(exists($ldap_result->{dn})) {
                        $hosts_database->{$packet->{source_haddr}}=$ldap_result;