Code

- Added Net::Arp libray and remove offending code not running on
authoropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sat, 27 Mar 2010 19:31:14 +0000 (19:31 +0000)
committeropensides <opensides@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sat, 27 Mar 2010 19:31:14 +0000 (19:31 +0000)
- opensuse 11 Closes #800

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17310 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/GosaSupportDaemon.pm

index 7d769c08ad6ff4e302a900203e214f955cb2b16c..197a09cc6e0625771a61e0302786c786642cffaf 100644 (file)
@@ -5,8 +5,8 @@ use Exporter;
 my @functions = (
     "create_passwd",
     "create_xml_hash",
-       "createXmlHash",
-       "myXmlHashToString",
+         "createXmlHash",
+         "myXmlHashToString",
     "get_content_from_xml_hash",
     "add_content2xml_hash",
     "create_xml_string",
@@ -50,6 +50,7 @@ use XML::Quote qw(:all);
 use XML::Simple;
 use Data::Dumper;
 use Net::DNS;
+use Net::ARP;
 use DateTime;
 
 my $op_hash = {
@@ -806,25 +807,7 @@ sub get_mac_for_interface {
                if($ifreq eq "all") {
                        $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 ($main::server_mac_address and length($main::server_mac_address) > 0) {
-                               $result= $main::server_mac_address;
-                       }
-
-                       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);
                }
        }
        return $result;