diff --git a/includes/html/pages/device/edit/ipmi.inc.php b/includes/html/pages/device/edit/ipmi.inc.php index 13fb0b7d5a..7c8fe8faa8 100644 --- a/includes/html/pages/device/edit/ipmi.inc.php +++ b/includes/html/pages/device/edit/ipmi.inc.php @@ -3,6 +3,7 @@ if ($_POST['editing']) { if (Auth::user()->hasGlobalAdmin()) { $ipmi_hostname = mres($_POST['ipmi_hostname']); + $ipmi_port = (int) $_POST['ipmi_port']; $ipmi_username = mres($_POST['ipmi_username']); $ipmi_password = mres($_POST['ipmi_password']); @@ -12,6 +13,12 @@ if ($_POST['editing']) { del_dev_attrib($device, 'ipmi_hostname'); } + if ($ipmi_port != '') { + set_dev_attrib($device, 'ipmi_port', $ipmi_port); + } else { + set_dev_attrib($device, 'ipmi_port', '623'); // Default port + } + if ($ipmi_username != '') { set_dev_attrib($device, 'ipmi_username', $ipmi_username); } else { @@ -50,6 +57,12 @@ if ($updated && $update_message) { +
+ +
+ +
+
diff --git a/includes/polling/ipmi.inc.php b/includes/polling/ipmi.inc.php index ba01d89083..21d65eeaaa 100644 --- a/includes/polling/ipmi.inc.php +++ b/includes/polling/ipmi.inc.php @@ -9,6 +9,7 @@ if (is_array($ipmi_rows)) { d_echo($ipmi_rows); if ($ipmi['host'] = $attribs['ipmi_hostname']) { + $ipmi['port'] = filter_var($attribs['ipmi_port'], FILTER_VALIDATE_INT) ? $attribs['ipmi_port'] : '623'; $ipmi['user'] = $attribs['ipmi_username']; $ipmi['password'] = $attribs['ipmi_password']; $ipmi['type'] = $attribs['ipmi_type']; @@ -17,7 +18,7 @@ if (is_array($ipmi_rows)) { $cmd = [Config::get('ipmitool', 'ipmitool')]; if (Config::get('own_hostname') != $device['hostname'] || $ipmi['host'] != 'localhost') { - array_push($cmd, '-H', $ipmi['host'], '-U', $ipmi['user'], '-P', $ipmi['password'], '-L', 'USER'); + array_push($cmd, '-H', $ipmi['host'], '-U', $ipmi['user'], '-P', $ipmi['password'], '-L', 'USER', '-p', $ipmi['port']); } // Check to see if we know which IPMI interface to use