Commit 6b0b2569 authored by Franco Fichtner's avatar Franco Fichtner

system: make sure vital kernel modules are loaded and refactor

This partially reverts commit 8ecaf5f9.
parent 7e4c3cf7
......@@ -1420,29 +1420,57 @@ function get_possible_listen_ips($include_ipv6_link_local = false, $include_loop
return $listenips;
}
function load_crypto_module()
function system_kernel_configure($verbose = false)
{
global $config;
if ($verbose) {
echo 'Configuring kernel modules...';
flush();
}
/*
* Vital kernel modules can go missing on reboot due to
* /boot/loader.conf not materialising. This is still
* an UFS problem, despite claims otherwise. In any case,
* load all the modules again to make sure.
*
* Keep in sync with /usr/local/etc/erc.loader.d/20-modules
*/
$mods = array(
'carp',
'if_bridge',
'if_enc',
'if_gif',
'if_gre',
'if_lagg',
'if_tap',
'if_tun',
'if_vlan',
'pf',
'pflog',
'pfsync',
);
foreach ($mods as $mod) {
mwexecf('/sbin/kldload %s', $mod, true);
}
if (!empty($config['system']['crypto_hardware'])) {
log_error(sprintf('Loading %s cryptographic accelerator module.', $config['system']['crypto_hardware']));
mwexecf('/sbin/kldload %s', $config['system']['crypto_hardware'], true);
}
if (isset($config['system']['cryptodev_enable'])) {
log_error('Loading cryptodev kernel module.');
mwexecf('/sbin/kldload %s', 'cryptodev', true);
}
}
function load_thermal_module()
{
global $config;
if (!empty($config['system']['thermal_hardware'])) {
log_error(sprintf('Loading %s thermal monitor module.', $config['system']['thermal_hardware']));
mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware'], true);
}
if ($verbose) {
echo "done.\n";
}
}
function system_cron_configure($verbose = false)
......
......@@ -105,11 +105,7 @@ if (is_interface_mismatch()) {
while (!set_networking_interfaces_ports(true));
}
/* enable optional crypto modules */
load_crypto_module();
/* enable optional thermal sensor modules */
load_thermal_module();
system_kernel_configure(true);
/* read in /etc/sysctl.conf and set values if needed */
echo "Setting up extended sysctls...";
......
......@@ -169,8 +169,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_resolvconf_generate(true);
system_cron_configure();
activate_powerd();
load_crypto_module();
load_thermal_module();
system_kernel_configure();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment