From 5574e028dc0ed802d4954b577151cc09c9687ee5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 3 Sep 2020 12:06:07 +0200 Subject: [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. --- modules-available/rebootcontrol/page.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules-available/rebootcontrol/page.inc.php') 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); -- cgit v1.2.3-55-g7522