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