From 26b348491f0599c4f059037a13c746c1792f4c83 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Fri, 15 May 2026 13:55:31 -0400 Subject: [PATCH 1/7] net/wol: make UDP port configurable (default 9) --- net/wol/Makefile | 4 ++-- .../controllers/OPNsense/Wol/Api/WolController.php | 4 +++- .../mvc/app/controllers/OPNsense/Wol/forms/host.xml | 8 +++++++- .../mvc/app/controllers/OPNsense/Wol/forms/wake.xml | 8 +++++++- .../src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml | 11 +++++++++-- .../opnsense/service/conf/actions.d/actions_wol.conf | 6 +++--- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/net/wol/Makefile b/net/wol/Makefile index 4bdc753546..7ec72d8df8 100644 --- a/net/wol/Makefile +++ b/net/wol/Makefile @@ -1,7 +1,7 @@ PLUGIN_NAME= wol PLUGIN_VERSION= 2.5 -PLUGIN_REVISION= 4 +PLUGIN_REVISION= 5 PLUGIN_DEPENDS= wol PLUGIN_COMMENT= Wake on LAN Service -.include "../../Mk/plugins.mk" +.include "../../Mk/plugins.mk" \ No newline at end of file diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php index 7b7841b5e7..f75cfe134d 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php @@ -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) diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml index 3c00c8232e..bdb3ee0571 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml @@ -11,10 +11,16 @@ text Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx + + host.port + + text + UDP port to send the magic packet to (1-65535). Defaults to 9. + host.descr text You may enter a description here for your reference (not parsed). - + \ No newline at end of file diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml index 096dd63627..fbd6184e1a 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml @@ -11,4 +11,10 @@ text Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx. - + + wake.port + + text + UDP port to send the magic packet to (1-65535). Defaults to 9. + + \ No newline at end of file diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml index 9fddd8987f..21650d5869 100644 --- a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml @@ -1,7 +1,7 @@ //wol Wake On Lan configuration - 1.0.0 + 1.0.1 @@ -16,7 +16,14 @@ 00:00:00:00:00:00 Should be 6 groups of 2 hex characters (a-fA-F0-9) separated by ':'. + + Y + 9 + 1 + 65535 + UDP port must be an integer between 1 and 65535. + - + \ No newline at end of file diff --git a/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf b/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf index 696fc145d1..ee390b63a7 100644 --- a/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf +++ b/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf @@ -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 +message:Waking up host on port %s with broadcast %s mac %s \ No newline at end of file From 7d154ec711848912b41c613dbebe3170428cded5 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Mon, 18 May 2026 13:11:46 -0400 Subject: [PATCH 2/7] Update net/wol/Makefile Suggest by sopex: Cleaner update Co-authored-by: Konstantinos Spartalis --- net/wol/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/net/wol/Makefile b/net/wol/Makefile index 7ec72d8df8..f7c4ce6e10 100644 --- a/net/wol/Makefile +++ b/net/wol/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= wol PLUGIN_VERSION= 2.5 -PLUGIN_REVISION= 5 PLUGIN_DEPENDS= wol PLUGIN_COMMENT= Wake on LAN Service From 24a3de44a6fe04946d576a2f2e2a617dd75b49b2 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Mon, 18 May 2026 13:14:40 -0400 Subject: [PATCH 3/7] Apply suggestions from code review sopex suggestion merge 2 Co-authored-by: Konstantinos Spartalis --- net/wol/Makefile | 4 ++-- .../opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml | 4 ++-- .../opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml | 4 ++-- net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml | 2 +- net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/net/wol/Makefile b/net/wol/Makefile index f7c4ce6e10..8e961a892e 100644 --- a/net/wol/Makefile +++ b/net/wol/Makefile @@ -1,6 +1,6 @@ PLUGIN_NAME= wol -PLUGIN_VERSION= 2.5 +PLUGIN_VERSION= 2.6 PLUGIN_DEPENDS= wol PLUGIN_COMMENT= Wake on LAN Service -.include "../../Mk/plugins.mk" \ No newline at end of file +.include "../../Mk/plugins.mk" diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml index bdb3ee0571..104757982c 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/host.xml @@ -15,7 +15,7 @@ host.port text - UDP port to send the magic packet to (1-65535). Defaults to 9. + UDP port to send the magic packet to (1-65535). host.descr @@ -23,4 +23,4 @@ text You may enter a description here for your reference (not parsed). - \ No newline at end of file + diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml index fbd6184e1a..ef0f0102e2 100644 --- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml +++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/forms/wake.xml @@ -15,6 +15,6 @@ wake.port text - UDP port to send the magic packet to (1-65535). Defaults to 9. + UDP port to send the magic packet to (1-65535). - \ No newline at end of file + diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml index 21650d5869..33350c8cce 100644 --- a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml @@ -26,4 +26,4 @@ - \ No newline at end of file + diff --git a/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf b/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf index ee390b63a7..1c0e3c62b4 100644 --- a/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf +++ b/net/wol/src/opnsense/service/conf/actions.d/actions_wol.conf @@ -2,5 +2,5 @@ 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 on port %s with broadcast %s mac %s \ No newline at end of file +description:Wake-On-LAN for host with broadcast Port, IP and MAC +message:Waking up host on port %s with broadcast %s mac %s From 42f587c1ab76056627aa9a20111b2bcd40063c61 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Mon, 18 May 2026 13:53:00 -0400 Subject: [PATCH 4/7] sopox suggestions commit Changed Integerfield to PortField in WoL.xml Modified index.volt to include port Added migration script --- .../models/OPNsense/Wol/Migrations/M1_0_1.php | 51 +++++++++++++++++++ .../mvc/app/models/OPNsense/Wol/Wol.xml | 6 +-- .../mvc/app/views/OPNsense/Wol/index.volt | 7 +-- 3 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php new file mode 100644 index 0000000000..17de9f220d --- /dev/null +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php @@ -0,0 +1,51 @@ + + * 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 +{ + /** + * 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 + */ + public function run($model) + { + parent::run($model); + foreach ($model->wolentry->iterateItems() as $host) { + if (empty((string)$host->port)) { + $host->port = '40000'; + } + } + } +} \ No newline at end of file diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml index 33350c8cce..eb247c52c5 100644 --- a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Wol.xml @@ -16,12 +16,10 @@ 00:00:00:00:00:00 Should be 6 groups of 2 hex characters (a-fA-F0-9) separated by ':'. - + Y 9 - 1 - 65535 - UDP port must be an integer between 1 and 65535. + UDP port must be a valid port number. diff --git a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt index 61dd88fd0c..636edabd85 100644 --- a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt +++ b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt @@ -98,11 +98,11 @@ $( document ).ready(function() {
{{ partial("layout_partials/base_form",['fields':wakeForm,'id':'frm_wol_wake'])}}
-
+
- +
@@ -110,6 +110,7 @@ $( document ).ready(function() { + @@ -118,7 +119,7 @@ $( document ).ready(function() { - +
{{ lang._('Interface') }} {{ lang._('MAC') }}{{ lang._('Port') }} {{ lang._('Description') }} {{ lang._('Commands') }}
From 6d4f941745ae650e3689e17a2444e05e7211c859 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Mon, 18 May 2026 14:38:29 -0400 Subject: [PATCH 5/7] Removed if statement for migration Changed function for autofill 40000 for migration by default. Port will be 9 as default for new installs. --- .../mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php | 11 +++-------- .../opnsense/mvc/app/views/OPNsense/Wol/index.volt | 1 + 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php index 17de9f220d..f0378b9f34 100644 --- a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php @@ -1,7 +1,7 @@ + * Copyright (C) 2026 touzenesmy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,19 +33,14 @@ class M1_0_1 extends BaseModelMigration { /** - * 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. + * Migrates from hardcoded port * @param $model */ public function run($model) { parent::run($model); foreach ($model->wolentry->iterateItems() as $host) { - if (empty((string)$host->port)) { - $host->port = '40000'; - } + $host->port = '40000'; } } } \ No newline at end of file diff --git a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt index 636edabd85..61085f8555 100644 --- a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt +++ b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt @@ -103,6 +103,7 @@ $( document ).ready(function() {
+
From fa0ebfe9cdeedaf6325b48d83e5b891b8001dd6c Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Mon, 18 May 2026 22:04:51 -0400 Subject: [PATCH 6/7] Apply suggestion from @sopex Co-authored-by: Konstantinos Spartalis --- net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt | 1 + 1 file changed, 1 insertion(+) diff --git a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt index 61085f8555..e3a7310bc1 100644 --- a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt +++ b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt @@ -104,6 +104,7 @@ $( document ).ready(function() {
+
From e2ad24607838f4db108c640697386759c0bcc6f7 Mon Sep 17 00:00:00 2001 From: Samy <12219635+touzenesmy@users.noreply.github.com> Date: Tue, 19 May 2026 10:28:08 -0400 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Konstantinos Spartalis --- .../opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php | 2 +- net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php index f0378b9f34..949df19605 100644 --- a/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php +++ b/net/wol/src/opnsense/mvc/app/models/OPNsense/Wol/Migrations/M1_0_1.php @@ -43,4 +43,4 @@ public function run($model) $host->port = '40000'; } } -} \ No newline at end of file +} diff --git a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt index e3a7310bc1..61085f8555 100644 --- a/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt +++ b/net/wol/src/opnsense/mvc/app/views/OPNsense/Wol/index.volt @@ -104,7 +104,6 @@ $( document ).ready(function() {
-