Commit 0af32b6a authored by Ad Schellevis's avatar Ad Schellevis

(captiveportal) let rc scripting handle ipfw/dummynet module loading

parent f97c9abf
......@@ -329,20 +329,6 @@ EOD;
return $htmltext;
}
function captiveportal_load_modules() {
global $config;
mute_kernel_msgs();
if (!is_module_loaded("ipfw.ko")) {
mwexec("/sbin/kldload ipfw");
}
/* Always load dummynet now that even allowed ip and mac passthrough use it. */
if (!is_module_loaded("dummynet.ko")) {
mwexec("/sbin/kldload dummynet");
set_sysctl(array("net.inet.ip.dummynet.io_fast" => "1", "net.inet.ip.dummynet.hash_size" => "256"));
}
unmute_kernel_msgs();
}
function captiveportal_configure() {
global $config, $cpzone, $cpzoneid;
......@@ -352,8 +338,6 @@ function captiveportal_configure() {
$cpc = new OPNsense\CaptivePortal\CPClient();
if ($cpc->isEnabled()) {
// load modules ( only if CP is enabled )
captiveportal_load_modules();
$cpc->reconfigure();
}
......
......@@ -91,14 +91,14 @@ class CPClient
*/
public function reconfigure()
{
$backend = new Backend();
if ($this->isEnabled()) {
$ruleset_filename = FactoryDefault::getDefault()->get('config')->globals->temp_path."/ipfw.rules";
$backend = new Backend();
$response = $backend->configdRun("template reload OPNsense.IPFW");
if (trim($response) == "OK") {
// load ruleset when ruleset is successfully loaded
$this->shell->exec("/sbin/ipfw -f ".$ruleset_filename);
$this->shell->exec("/etc/rc.d/ipfw start");
}
// update tables
......@@ -107,8 +107,9 @@ class CPClient
// after reinit all accounting rules are vanished, reapply them for active sessions
$this->loadAccounting();
} else {
// captiveportal is disabled, flush all rules to be sure
$this->shell->exec("/sbin/ipfw -f flush");
// captiveportal is disabled, create new config and reload ipfw
$response = $backend->configdRun("template reload OPNsense.IPFW");
$this->shell->exec("/etc/rc.d/ipfw start");
}
}
......
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