diff options
author | Ermal <eri@pfsense.org> | 2010-06-21 11:02:35 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-06-21 11:02:35 +0000 |
commit | 1d9e9ccac43f61ed20b9181940fc12ba9e84096f (patch) | |
tree | 2e1bb134ec66d4e5cd8208abec846bd5f46d1ace /etc/inc/captiveportal.inc | |
parent | d4b17d7ce7bb02806e28ba1c79d5679d5c3a43d4 (diff) | |
download | pfsense-1d9e9ccac43f61ed20b9181940fc12ba9e84096f.zip pfsense-1d9e9ccac43f61ed20b9181940fc12ba9e84096f.tar.gz |
Do not flush all tables unless Save was hit on webgui. This avoids flushing the tables that keep logged in users.
Diffstat (limited to 'etc/inc/captiveportal.inc')
-rw-r--r-- | etc/inc/captiveportal.inc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index a4e5d55..1b2d361 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -73,11 +73,8 @@ function captiveportal_configure() { /* kill any running minicron */ killbypid("{$g['varrun_path']}/minicron.pid"); - /* init dummynet/ipfw rules number database */ - captiveportal_init_ipfw_ruleno(); - /* init ipfw rules */ - captiveportal_init_rules(); + captiveportal_init_rules(true); /* stop accounting on all clients */ captiveportal_radius_stop_all(true); @@ -341,7 +338,7 @@ function captiveportal_init_webgui() { $res = mwexec("/usr/local/sbin/lighttpd -f {$g['varetc_path']}/lighty-CaptivePortal-SSL.conf"); } -function captiveportal_init_rules() { +function captiveportal_init_rules($reinit = false) { global $config, $g; if (!isset($config['captiveportal']['enable'])) @@ -387,6 +384,9 @@ function captiveportal_init_rules() { } else return false; + /* init dummynet/ipfw rules number database */ + captiveportal_init_ipfw_ruleno(); + /* make sure ipfw is loaded */ if (!is_module_loaded("ipfw.ko")) filter_load_ipfw(); @@ -512,7 +512,20 @@ EOD; $cprules .= captiveportal_allowedip_configure(); /* load rules */ - $cprules = "table all flush\nflush\n{$cprules}"; + if ($reinit == true) + $cprules = "table all flush\nflush\n{$cprules}"; + else { + $tmprules = "table 3 flush\n"; + $tmprules .= "table 4 flush\n"; + $tmprules .= "table 5 flush\n"; + $tmprules .= "table 6 flush\n"; + $tmprules .= "table 7 flush\n"; + $tmprules .= "table 8 flush\n"; + $tmprules .= "table 9 flush\n"; + $tmprules .= "table 10 flush\n"; + $tmprules .= "flush\n"; + $cprules = "{$tmprules}\n{$cprules}"; + } if (file_put_contents("{$g['tmp_path']}/ipfw.cp.rules", $cprules)) { mwexec("/sbin/ipfw -q {$g['tmp_path']}/ipfw.cp.rules", true); //@unlink("{$g['tmp_path']}/ipfw.cp.rules"); |