From 1372ae55f99d70a4baefc510aaf8e9e9de45c2d3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 7 Dec 2008 20:13:07 +0000 Subject: 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. --- etc/inc/filter.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'etc/inc') diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index c3b711f..5f18374 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -53,6 +53,8 @@ function filter_pflog_start() { echo "filter_pflog_start() being called $mt\n"; } + if($g['booting']) + echo "Starting pflog0..."; mute_kernel_msgs(); $pid = `ps awwwux | grep -v "grep" | grep "tcpdump -s 256 -v -l -n -e -ttt -i pflog0" | awk '{ print $2 }'`; @@ -61,6 +63,9 @@ function filter_pflog_start() { unmute_kernel_msgs(); + if($g['booting']) + echo "done.\n"; + } /* reload filter async */ @@ -162,6 +167,9 @@ function filter_configure_sync() { 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"; @@ -216,6 +224,13 @@ function filter_configure_sync() { 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"; -- cgit v1.1