From b0598dabf3c583deb2a469507e19f447de41b141 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Thu, 3 Jul 2008 15:45:31 +0000 Subject: [PATCH] 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 --- gosa-si/server/events/server_server_com.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- 2.30.2