Commit 57bdab56 authored by Franco Fichtner's avatar Franco Fichtner

inc: minor tweaks and simplifications

(cherry picked from commit 0822b3dd)
parent f03de524
......@@ -3346,8 +3346,8 @@ function interface_6rd_configure($interface = "wan", $wancfg)
return;
}
if (!is_module_loaded('if_stf.ko')) {
mwexec('/sbin/kldload if_stf.ko');
if (!is_module_loaded('if_stf')) {
mwexec('/sbin/kldload if_stf');
}
$wanif = get_real_interface($interface);
......@@ -3384,7 +3384,7 @@ function interface_6rd_configure($interface = "wan", $wancfg)
/* XXX: need to extend to support variable prefix size for v4 */
if (!is_module_loaded('if_stf')) {
mwexec('/sbin/kldload if_stf.ko');
mwexec('/sbin/kldload if_stf');
}
$stfiface = "{$interface}_stf";
if (does_interface_exist($stfiface)) {
......@@ -3497,7 +3497,7 @@ function interface_6to4_configure($interface = 'wan', $wancfg)
/* setup the stf interface */
if (!is_module_loaded("if_stf")) {
mwexec("/sbin/kldload if_stf.ko");
mwexec("/sbin/kldload if_stf");
}
$stfiface = "{$interface}_stf";
if (does_interface_exist($stfiface)) {
......
......@@ -215,7 +215,7 @@ function legacy_netgraph_attach($ifs)
function legacy_netgraph_detach($ifs)
{
mwexecf('/usr/sbin/ngctl msg %s: detach', array($ifs));
mwexecf('/usr/sbin/ngctl msg %s: detach', array($ifs), true);
}
function legacy_netgraph_rename($tmpifs, $ifs)
......
......@@ -72,15 +72,7 @@ function is_process_running($process)
function is_subsystem_dirty($subsystem = '')
{
if ($subsystem == '') {
return false;
}
if (file_exists("/tmp/{$subsystem}.dirty")) {
return true;
}
return false;
return file_exists("/tmp/{$subsystem}.dirty");
}
function mark_subsystem_dirty($subsystem = '')
......@@ -124,14 +116,9 @@ function unlock($cfglckkey = null)
}
}
function is_module_loaded($module_name) {
$module_name = str_replace(".ko", "", $module_name);
$running = 0;
$_gb = exec("/sbin/kldstat -qn {$module_name} 2>&1", $_gb, $running);
if (intval($running) == 0)
return true;
else
return false;
function is_module_loaded($module_name)
{
return !mwexecf('/sbin/kldstat -qn %s', $module_name, true);
}
/* validate non-negative numeric string, or equivalent numeric variable */
......
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