mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
(captiveportal) let rc scripting handle ipfw/dummynet module loading
This commit is contained in:
parent
f97c9abf9e
commit
0af32b6aab
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user