diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-12-07 20:13:00 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-12-07 20:13:00 +0000 |
commit | 8f158ea1e4469c96170b1874a4c1c560af0e2d67 (patch) | |
tree | 365bf3e03632b779367f6fae42030d2a0ca4878d /etc/inc/filter.inc | |
parent | 70281b3a8927b063069fd6c1dda9b07f656b379e (diff) | |
download | pfsense-8f158ea1e4469c96170b1874a4c1c560af0e2d67.zip pfsense-8f158ea1e4469c96170b1874a4c1c560af0e2d67.tar.gz |
Compare rules.debug to previously loaded rules. If no rule changes
have occured, do not try to reload the rules and sync changes to backup
members which can result in the rules being reloaded constantly when
load balancing is in use, etc.
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r-- | etc/inc/filter.inc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 1cd17e8..3f8aaf8 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -149,6 +149,10 @@ function filter_configure_sync() { echo "done.\n"; return; } + + // Copy rules.debug to rules.debug.old + exec("cp {$g['tmp_path']}/rules.debug {$g['tmp_path']}/rules.debug.old"); + $fd = fopen("{$g['tmp_path']}/rules.debug", "w"); $rules .= "{$aliases} \n"; update_filter_reload_status("Setting up logging information"); @@ -172,13 +176,22 @@ function filter_configure_sync() { $rules.= "{$altq_queues}\n"; $rules.= "{$natrules}\n"; $rules.= "{$pfrules}\n"; + fwrite($fd, $rules); fclose($fd); + + $rules = file_get_contents("{$g['tmp_path']}/rules.debug"); + $oldrules = file_get_contents("{$g['tmp_path']}/rules.debug.old"); + + /* Check to see if rules changed, if not do not continue */ + if($rules == $oldrules) + return; + if(isset($config['system']['developerspew'])) { $mt = microtime(); echo "pfctl being called at $mt\n"; } - $rules_loading = mwexec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug"); + $rules_loading = mwexec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug"); if(isset($config['system']['developerspew'])) { $mt = microtime(); echo "pfctl done at $mt\n"; |