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; ...@@ -329,20 +329,6 @@ EOD;
return $htmltext; 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() { function captiveportal_configure() {
global $config, $cpzone, $cpzoneid; global $config, $cpzone, $cpzoneid;
...@@ -352,8 +338,6 @@ function captiveportal_configure() { ...@@ -352,8 +338,6 @@ function captiveportal_configure() {
$cpc = new OPNsense\CaptivePortal\CPClient(); $cpc = new OPNsense\CaptivePortal\CPClient();
if ($cpc->isEnabled()) { if ($cpc->isEnabled()) {
// load modules ( only if CP is enabled )
captiveportal_load_modules();
$cpc->reconfigure(); $cpc->reconfigure();
} }
......
...@@ -91,14 +91,14 @@ class CPClient ...@@ -91,14 +91,14 @@ class CPClient
*/ */
public function reconfigure() public function reconfigure()
{ {
$backend = new Backend();
if ($this->isEnabled()) { if ($this->isEnabled()) {
$ruleset_filename = FactoryDefault::getDefault()->get('config')->globals->temp_path."/ipfw.rules"; $ruleset_filename = FactoryDefault::getDefault()->get('config')->globals->temp_path."/ipfw.rules";
$backend = new Backend();
$response = $backend->configdRun("template reload OPNsense.IPFW"); $response = $backend->configdRun("template reload OPNsense.IPFW");
if (trim($response) == "OK") { if (trim($response) == "OK") {
// load ruleset when ruleset is successfully loaded // 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 // update tables
...@@ -107,8 +107,9 @@ class CPClient ...@@ -107,8 +107,9 @@ class CPClient
// after reinit all accounting rules are vanished, reapply them for active sessions // after reinit all accounting rules are vanished, reapply them for active sessions
$this->loadAccounting(); $this->loadAccounting();
} else { } else {
// captiveportal is disabled, flush all rules to be sure // captiveportal is disabled, create new config and reload ipfw
$this->shell->exec("/sbin/ipfw -f flush"); $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