It uses php code:
/****f* pfsense-utils/WakeOnLan
* NAME
* WakeOnLan - Wake a machine up using the wake on lan format/protocol
* RESULT
* true/false - true if the operation was successful
******/
function WakeOnLan($addr, $mac)
{
$addr_byte = explode(':', $mac);
$hw_addr = '';
for ($a=0; $a < 6; $a++)
$hw_addr .= chr(hexdec($addr_byte[$a]));
$msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255);
for ($a = 1; $a <= 16; $a++)
$msg .= $hw_addr;
// send it to the broadcast address using UDP
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if ($s == false) {
log_error("Error creating socket!");
log_error("Error code is '".socket_last_error($s)."' - " .
socket_strerror(socket_last_error($s)));
} else {
// setting a broadcast option to socket:
$opt_ret = socket_set_option($s, 1, 6, TRUE);
if($opt_ret < 0)
log_error("setsockopt() failed, error: " .
strerror($opt_ret));
$e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050);
socket_close($s);
log_error("Magic Packet sent ({$e}) to {$addr} MAC={$mac}");
return true;
}
return false;
}
Scott
On 12/21/06, Josep Pujadas i Jubany <[EMAIL PROTECTED]> wrote:
On Thu, 21 Dec 2006 07:39:01 +0100, Josep Pujadas i Jubany wrote
> Hello!
>
> Wich packet is using pfSense to make WOL calls?
>
> Thanks,
>
> Josep Pujadas
I'm sorry!
I would like to say "wich package" ...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]