-
Notifications
You must be signed in to change notification settings - Fork 825
net/wol: make UDP port configurable (default 9) #5448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
26b3484
7d154ec
24a3de4
42f587c
6d4f941
fa0ebfe
e2ad246
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
touzenesmy marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||
| 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"> | ||
|
|
@@ -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> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the issue with requiring this is now the user needs to input it or else validation fails. "9" isn't added automatically and the migration uses '4000' which would be automatic if we used that default ;)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <Default>9</Default> | ||
| <ValidationMessage>UDP port must be a valid port number.</ValidationMessage> | ||
| </port> | ||
| <descr type="TextField"/> | ||
| </wolentry> | ||
| </items> | ||
|
|
||
| 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 |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be rewritten for configdpRun() second argument is the array with all unescaped values.. ideally from getValue() and not string cast