Skip to content

Commit

Permalink
system: render tunables in loader.conf; closes #2083
Browse files Browse the repository at this point in the history
(cherry picked from commit 68cfe2a)
(cherry picked from commit fdf4ecc)
(cherry picked from commit c2c4a24)
  • Loading branch information
fichtner committed Mar 17, 2018
1 parent b577fc7 commit bf658e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
15 changes: 10 additions & 5 deletions src/etc/inc/system.inc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function get_default_sysctl_value($id)
return null;
}

function activate_sysctls()
function system_sysctl_get()
{
global $config;

Expand All @@ -147,7 +147,7 @@ function activate_sysctls()
}
}

set_sysctl($sysctls);
return $sysctls;
}

function system_resolvconf_generate($verbose = false)
Expand Down Expand Up @@ -956,7 +956,7 @@ function system_sysctl_configure($verbose = false)
flush();
}

activate_sysctls();
set_sysctl(system_sysctl_get());
system_arp_wrong_if();

if ($verbose) {
Expand Down Expand Up @@ -1307,8 +1307,13 @@ function system_login_configure($verbose = false)
/* copy settings already there */
$new_loader_conf = @file_get_contents('/boot/loader.conf');

/* append our console options */
$new_loader_conf .= "# dynamically generated settings follow\n";
$new_loader_conf .= "# dynamically generated tunables settings follow\n";
foreach (system_sysctl_get() as $param => $value) {
$new_loader_conf .= "{$param}=\"{$value}\"\n";
}
$new_loader_conf .= "\n";

$new_loader_conf .= "# dynamically generated console settings follow\n";
foreach ($new_boot_config as $param => $value) {
if (!empty($value)) {
$new_loader_conf .= "{$param}={$value}\n";
Expand Down
4 changes: 2 additions & 2 deletions src/www/guiconfig.inc
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ function print_alert_box($msg, $alert = 'warning', $button = '')
{
echo <<<EOFnp
<div class="col-xs-12">
<div class="alert alert-{$alert}" role="alert">
<div class="alert alert-{$alert}" role="alert" style="min-height: 65px;">
{$button}
<p>{$msg}</p>
<div style="margin-top: 8px;">{$msg}</div>
</div>
</div>
EOFnp;
Expand Down
12 changes: 10 additions & 2 deletions src/www/system_advanced_sysctl.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
exit;
} else if (!empty($pconfig['apply'])) {
system_sysctl_configure();
system_login_configure();
clear_subsystem_dirty('sysctl');
header(url_safe('Location: /system_advanced_sysctl.php'));
exit;
Expand All @@ -92,18 +93,19 @@
header(url_safe('Location: /system_advanced_sysctl.php'));
exit;
}

}

legacy_html_escape_form_data($a_tunable);

if ($act != 'edit') {
$main_buttons = array(
array('href' => 'system_advanced_sysctl.php?act=edit', 'label' => gettext('Add a new tunable')),
);
}

include("head.inc");
?>

?>
<body>
<script>
$( document ).ready(function() {
Expand Down Expand Up @@ -186,6 +188,12 @@
</tr>
<?php
$i++; endforeach; ?>
<tr>
<td colspan="4">
<?= gettext('Tunables are composed of runtime settings for sysctl.conf which take effect ' .
'immediately after apply and boot settings for loader.conf which require a reboot.') ?>
</td>
</tr>
</tbody>
</table>
<?php
Expand Down

0 comments on commit bf658e8

Please sign in to comment.