summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2020-09-03 12:06:07 +0200
committerSimon Rettberg2020-09-03 12:06:07 +0200
commit5574e028dc0ed802d4954b577151cc09c9687ee5 (patch)
tree5c5e5d49740aa0ee8f80ad664f2408d89eecc65b /modules-available/rebootcontrol/page.inc.php
parent[serversetup-bwlp-ipxe/rebootcontrol] Fix translations (diff)
downloadslx-admin-5574e028dc0ed802d4954b577151cc09c9687ee5.tar.gz
slx-admin-5574e028dc0ed802d4954b577151cc09c9687ee5.tar.xz
slx-admin-5574e028dc0ed802d4954b577151cc09c9687ee5.zip
[rebootcontrol] WOL: Make UDP-Port and c2c discovery configurable
The port setting only applies to WOL-packets sent from the satellite server. Testing the reachability of client subnets between each other is usually pointless, since a subnet that is reachable from another subnet can also be reached form the satelitte server, unless some fancy firewall rules are in place.
Diffstat (limited to 'modules-available/rebootcontrol/page.inc.php')
-rw-r--r--modules-available/rebootcontrol/page.inc.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules-available/rebootcontrol/page.inc.php b/modules-available/rebootcontrol/page.inc.php
index cf87a3b3..571e92e0 100644
--- a/modules-available/rebootcontrol/page.inc.php
+++ b/modules-available/rebootcontrol/page.inc.php
@@ -46,7 +46,11 @@ class Page_RebootControl extends Page
} elseif ($action === 'toggle-wol') {
User::assertPermission('woldiscover');
$enabled = Request::post('enabled', false);
+ $c2c = Request::post('enabled-c2c', false);
+ $port = Request::post('port', 9, 'int');
Property::set(RebootControl::KEY_AUTOSCAN_DISABLED, !$enabled);
+ Property::set(RebootControl::KEY_SCAN_CLIENT_TO_CLIENT, $c2c);
+ Property::set(RebootControl::KEY_UDP_PORT, $port);
if ($enabled) {
Message::addInfo('woldiscover-enabled');
} else {
@@ -98,10 +102,16 @@ class Page_RebootControl extends Page
protected function doRender()
{
+ $port = (int)Property::get(RebootControl::KEY_UDP_PORT);
+ if ($port < 1 || $port > 65535) {
+ $port = 9;
+ }
// Always show public key (it's public, isn't it?)
$data = [
'pubkey' => SSHKey::getPublicKey(),
'wol_auto_checked' => Property::get(RebootControl::KEY_AUTOSCAN_DISABLED) ? '' : 'checked',
+ 'wol_c2c_checked' => Property::get(RebootControl::KEY_SCAN_CLIENT_TO_CLIENT) ? 'checked' : '',
+ 'port' => $port,
];
Permission::addGlobalTags($data['perms'], null, ['newkeypair', 'woldiscover']);
Render::addTemplate('header', $data);