summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2020-03-27 12:45:49 +0100
committerSimon Rettberg2020-05-07 12:38:41 +0200
commitbc84c36587d5c025baf81f0eb9a8d8024aae36a3 (patch)
tree9e0708f4f23bfe344e56a6eb6da14018329caaaf
parent[dozmod] Remobe special section from menu (diff)
downloadslx-admin-bc84c36587d5c025baf81f0eb9a8d8024aae36a3.tar.gz
slx-admin-bc84c36587d5c025baf81f0eb9a8d8024aae36a3.tar.xz
slx-admin-bc84c36587d5c025baf81f0eb9a8d8024aae36a3.zip
[rebootcontrol] Fix indirect subnet to subnet WOL
The query for getting clients that can reach a client in another subnet was broken in that it didn't check for actual reachability from src to dst. Then the wrong array key was accessed when trying to wake clients via this method.
-rw-r--r--modules-available/rebootcontrol/inc/rebootcontrol.inc.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
index 4e21deee..abbef0c9 100644
--- a/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
+++ b/modules-available/rebootcontrol/inc/rebootcontrol.inc.php
@@ -434,7 +434,7 @@ class RebootControl
}
}
if (!$ok && !empty($subnet['iclients'])) {
- $ok = self::wakeGroup('across subnets', $tasks, $errors, $subnet['dclients'], $subnet['indirect'], $subnet['end']);
+ $ok = self::wakeGroup('across subnets', $tasks, $errors, $subnet['iclients'], $subnet['indirect'], $subnet['end']);
}
if (!$ok) {
$errors .= "I'm all out of ideas.\n";
@@ -486,7 +486,7 @@ class RebootControl
{
if (isset($subnet['dclients']))
return;
- $cutoff = time() - 302;
+ $cutoff = time() - 320;
// Get clients from same subnet first
$subnet['dclients'] = Database::queryAll("SELECT machineuuid, clientip FROM machine
WHERE state IN ('IDLE', 'OCCUPIED') AND INET_ATON(clientip) BETWEEN :start AND :end AND lastseen > :cutoff
@@ -497,7 +497,7 @@ class RebootControl
return;
// If none, get clients from other subnets known to be able to reach this one
$subnet['iclients'] = Database::queryAll("SELECT m.machineuuid, m.clientip FROM reboot_subnet_x_subnet sxs
- INNER JOIN reboot_subnet s ON (s.subnetid = sxs.srcid AND sxs.dstid = :subnetid)
+ INNER JOIN reboot_subnet s ON (s.subnetid = sxs.srcid AND sxs.dstid = :subnetid AND sxs.reachable = 1)
INNER JOIN machine m ON (INET_ATON(m.clientip) BETWEEN s.start AND s.end AND state IN ('IDLE', 'OCCUPIED') AND m.lastseen > :cutoff)
LIMIT 20", ['subnetid' => $subnet['subnetid'], 'cutoff' => $cutoff]);
shuffle($subnet['iclients']);