diff options
author | jim-p <jimp@pfsense.org> | 2013-07-30 14:07:58 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-07-30 14:09:08 -0400 |
commit | 5db98b2123d6b16f6f0e0d089957e340772836f9 (patch) | |
tree | 9dcbb9829e27454f6ca0fda848134e4582ce0bb0 /etc/inc/filter.inc | |
parent | 1e8635e880d595972d3f34e0e2947e9acb4dd607 (diff) | |
download | pfsense-5db98b2123d6b16f6f0e0d089957e340772836f9.zip pfsense-5db98b2123d6b16f6f0e0d089957e340772836f9.tar.gz |
Fix up filter_pflog_start - optimize some code, and fix $retval so that it will be restarted correctly after killing it.
Diffstat (limited to 'etc/inc/filter.inc')
-rw-r--r-- | etc/inc/filter.inc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 6394e6a..bcd8931 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -108,13 +108,16 @@ function filter_pflog_start($kill_first = false) { } mute_kernel_msgs(); $output = 0; - exec("/bin/pgrep -af 'tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0'", $output, $retval); + $tcpdump_cmd = "tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0"; + exec("/bin/pgrep -af '{$tcpdump_cmd}'", $output, $retval); if ($kill_first && ($output[0] > 1)) { mwexec("/bin/kill {$output[0]}"); usleep(1000); + /* Ensure the restart below runs */ + $retval = 1; } if($retval != 0) - mwexec_bg("/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0 | logger -t pf -p local0.info"); + mwexec_bg("/usr/sbin/{$tcpdump_cmd} | logger -t pf -p local0.info"); unmute_kernel_msgs(); } |