diff options
author | jim-p <jim@pingle.org> | 2009-05-06 16:31:14 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2009-05-06 16:31:14 -0400 |
commit | 21fcd99a621c1b761f04542b297ee77142d8a40e (patch) | |
tree | ffe4d79b1c888823f92ad4ab62646447f001ddcc /usr | |
parent | ab046d5a35c1776cb936a9b1cac7f428c7856637 (diff) | |
download | pfsense-21fcd99a621c1b761f04542b297ee77142d8a40e.zip pfsense-21fcd99a621c1b761f04542b297ee77142d8a40e.tar.gz |
Fix CLI filter parser so it works on FreeBSD 8 builds.
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/filterparser.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/usr/local/www/filterparser.php b/usr/local/www/filterparser.php index e352746..79e927d 100644 --- a/usr/local/www/filterparser.php +++ b/usr/local/www/filterparser.php @@ -35,13 +35,25 @@ clog /var/log/filter.log | tail -50 | /usr/local/www/filterparser.php clog -f /var/log/filter.log | /usr/local/www/filterparser.php */ +include_once("functions.inc"); include_once("filter_log.inc"); -include_once("interfaces.inc"); $log = fopen("php://stdin", "r"); +$lastline = ""; while(!feof($log)) { $line = fgets($log); - $flent = parse_filter_line(trim($line)); + $line = rtrim($line); + $line_split = ""; + preg_match("/.*\spf:\s(.*)/", $line, $line_split); + if (substr($line_split[1], 0, 4) != " ") { + $flent = ""; + if (($lastline != "") && (substr($lastline, 0, 1) != " ")) { + $flent = parse_filter_line(trim($lastline)); + } + $lastline = $line; + } else { + $lastline .= substr($line_split[1], 3); + } /* Available fields: time - Time the packet was seen rulenum - Rule number matched |