From: opensides Date: Sat, 27 Mar 2010 19:40:01 +0000 (+0000) Subject: - Added library Net::Arp and corrected function to make it work X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3bc6a2773e7fc183da5e445449965995de275999;p=gosa.git - Added library Net::Arp and corrected function to make it work - OpenSuse Closes #799 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17311 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index 992dda4c3..9417ecb16 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -37,6 +37,7 @@ use MIME::Base64; use XML::Simple; use File::Basename; use File::Spec; +use Net::ARP; use Fcntl; # Workaround: need pure perl to make it work with UTF-8 :-( @@ -297,25 +298,12 @@ sub get_mac { $result = "00:00:00:00:00:00"; } } else { - my $SIOCGIFHWADDR= 0x8927; # man 2 ioctl_list - # A configured MAC Address should always override a guessed value if ($client_mac_address and length($client_mac_address) > 0 and not($client_mac_address eq "00:00:00:00:00:00")) { $result= $client_mac_address; } else { - socket SOCKET, PF_INET, SOCK_DGRAM, getprotobyname('ip') - or die "socket: $!"; - - if(ioctl SOCKET, $SIOCGIFHWADDR, $ifreq) { - my ($if, $mac)= unpack 'h36 H12', $ifreq; - - if (length($mac) > 0) { - $mac=~ m/^([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])$/; - $mac= sprintf("%s:%s:%s:%s:%s:%s", $1, $2, $3, $4, $5, $6); - $result = $mac; - } - } + $result = Net::ARP::get_mac($ifreq); } } } diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 197a09cc6..8d3caad0a 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -803,7 +803,7 @@ sub get_local_ip_for_remote_ip { sub get_mac_for_interface { my $ifreq= shift; my $result; - if ($ifreq && length($ifreq) > 0) { + if ($ifreq && length($ifreq) > 0) { if($ifreq eq "all") { $result = "00:00:00:00:00:00"; } else {