Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions net/wol/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PLUGIN_NAME= wol
PLUGIN_VERSION= 2.5
PLUGIN_REVISION= 4
PLUGIN_VERSION= 2.6
PLUGIN_DEPENDS= wol
PLUGIN_COMMENT= Wake on LAN Service

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ private function wakeHostByNode($wolent, &$result)
return $result;
}
$broadcast_ip = escapeshellarg($this->calculateSubnetBroadcast($ipaddr, $cidr));
$result['status'] = trim($backend->configdRun("wol wake {$broadcast_ip} " . escapeshellarg((string)$wolent->mac)));
$port = escapeshellarg((string)$wolent->port);
$mac = escapeshellarg((string)$wolent->mac);
$result['status'] = trim($backend->configdRun("wol wake {$port} {$broadcast_ip} {$mac}"));
}

private function getInterfaceIP($if)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<type>text</type>
<help>Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx</help>
</field>
<field>
<id>host.port</id>
<label>UDP port</label>
<type>text</type>
<help>UDP port to send the magic packet to (1-65535).</help>
</field>
<field>
<id>host.descr</id>
<label>Description</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
<type>text</type>
<help>Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx.</help>
</field>
<field>
<id>wake.port</id>
<label>UDP port</label>
<type>text</type>
<help>UDP port to send the magic packet to (1-65535).</help>
</field>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* Copyright (C) 2026 touzenesmy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\Wol\Migrations;

use OPNsense\Base\BaseModelMigration;

class M1_0_1 extends BaseModelMigration
{
/**
* Migrates from hardcoded port
* @param $model
*/
Comment on lines +35 to +38
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Existing WoL hosts predate the configurable port and were always
* sent to UDP port 40000 (the previous hard-coded value). Preserve
* that behaviour on upgrade so existing hosts keep working; only new
* hosts get the sane default of 9.
* @param $model
*/
/**
* Migrates from hardcoded port
* @param $model
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

public function run($model)
{
parent::run($model);
foreach ($model->wolentry->iterateItems() as $host) {
$host->port = '40000';
}
}
}
7 changes: 6 additions & 1 deletion net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<model>
<mount>//wol</mount>
<description>Wake On Lan configuration</description>
<version>1.0.0</version>
<version>1.0.1</version>
<items>
<wolentry type="ArrayField">
<interface type="InterfaceField">
Expand All @@ -16,6 +16,11 @@
<Default>00:00:00:00:00:00</Default>
<ValidationMessage>Should be 6 groups of 2 hex characters (a-fA-F0-9) separated by ':'.</ValidationMessage>
</mac>
<port type="PortField">
<Required>Y</Required>
<Default>9</Default>
<ValidationMessage>UDP port must be a valid port number.</ValidationMessage>
</port>
<descr type="TextField"/>
</wolentry>
</items>
Expand Down
6 changes: 4 additions & 2 deletions net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ $( document ).ready(function() {
<div class="content-box" style="padding-bottom: 1.5em;">
{{ partial("layout_partials/base_form",['fields':wakeForm,'id':'frm_wol_wake'])}}
<div class="col-md-12">
<hr />
<br>
<button class="btn btn-primary" id="wakeAct" type="button"><b>{{ lang._('Wake up') }}</b> <i id="wakeAct_progress"></i></button>
</div>
</div>
<br>
Comment thread
touzenesmy marked this conversation as resolved.

Comment thread
touzenesmy marked this conversation as resolved.
<div class="content-box" style="padding-bottom: 1.5em;">

Expand All @@ -110,6 +111,7 @@ $( document ).ready(function() {
<tr>
<th data-column-id="interface" data-type="string" data-visible="true">{{ lang._('Interface') }}</th>
<th data-column-id="mac" data-type="string" data-visible="true">{{ lang._('MAC') }}</th>
<th data-column-id="port" data-type="string" data-visible="true">{{ lang._('Port') }}</th>
<th data-column-id="descr" data-type="string" data-identifier="true">{{ lang._('Description') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false" data-width="130">{{ lang._('Commands') }}</th>
</tr>
Expand All @@ -118,7 +120,7 @@ $( document ).ready(function() {
</tbody>
<tfoot>
<tr>
<td colspan="3"></td>
<td colspan="4"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<button type="button" class="btn btn-xs reload_btn btn-primary" id="act_wake_all"><span class="fa wakeallAct_progress"></span> {{ lang._('Wake All') }}</button>
Expand Down
8 changes: 4 additions & 4 deletions net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[wake]
command:/usr/local/bin/wol -i
parameters: %s %s
command:/usr/local/bin/wol
parameters: -p %s -i %s %s
type:script
description:Wake-On-LAN for host with broadcast IP and MAC
message:Waking up host %s %s
description:Wake-On-LAN for host with broadcast Port, IP and MAC
message:Waking up host on port %s with broadcast %s mac %s