From: rettenbe Date: Thu, 3 Jul 2008 15:45:31 +0000 (+0000) Subject: more debug information if wake on lan does not work X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b0598dabf3c583deb2a469507e19f447de41b141;p=gosa.git more debug information if wake on lan does not work git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11530 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/server/events/server_server_com.pm b/gosa-si/server/events/server_server_com.pm index 819b10be6..e980dbad8 100644 --- a/gosa-si/server/events/server_server_com.pm +++ b/gosa-si/server/events/server_server_com.pm @@ -221,6 +221,10 @@ sub trigger_wake { my $host = $_; my $ipaddr = '255.255.255.255'; my $port = getservbyname('discard', 'udp'); + if (not defined $port) { + &main::daemon_log("$session_id ERROR: cannot determine port for wol $_: 'getservbyname('discard', 'udp')' failed!",1); + next; + } my ($raddr, $them, $proto); my ($hwaddr, $hwaddr_re, $pkt); @@ -242,12 +246,16 @@ sub trigger_wake { # Allocate socket and send packet $raddr = gethostbyname($ipaddr); + if (not defined $raddr) { + &main::daemon_log("$session_id ERROR: cannot determine raddr for wol $_: 'gethostbyname($ipaddr)' failed!", 1); + next; + } + $them = pack_sockaddr_in($port, $raddr); $proto = getprotobyname('udp'); socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!"; setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!"; - send(S, $pkt, 0, $them) or die "send : $!"; close S; }