summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2014-12-21 21:50:54 +0545
committerPhil Davis <phil.davis@inf.org>2014-12-21 21:50:54 +0545
commitacfef9f5f790a8fbdd4bafa8838ceedd227236be (patch)
tree503a2b8e9239b089eaa08630635ea7c1bb3cbcad /usr
parentc120bd8da9cd31857572784202e1dca465970688 (diff)
downloadpfsense-acfef9f5f790a8fbdd4bafa8838ceedd227236be.zip
pfsense-acfef9f5f790a8fbdd4bafa8838ceedd227236be.tar.gz
Standardise dynamic firewall log view
to be like Firewall Log widget: 1) Display IPv6 address and port in [a:b::c]:123 format 2) Fix same issue with rows gradually disappearing each update, or when in reverse order, update lines not being put in the right place. 3) Update the processing of function format_log_line(row) to reflect the changed list of data items returned by handle_ajax() in filter_log.inc
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/diag_logs_filter_dynamic.php53
1 files changed, 44 insertions, 9 deletions
diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php
index d4722f0..2413bf2 100755
--- a/usr/local/www/diag_logs_filter_dynamic.php
+++ b/usr/local/www/diag_logs_filter_dynamic.php
@@ -1,7 +1,7 @@
<?php
/* $Id$ */
/*
- diag_logs_filter.php
+ diag_logs_filter_dynamic.php
part of pfSesne
Copyright (C) 2004-2009 Scott Ullrich
Copyright (C) 2013-2014 Electric Sheep Fencing, LP
@@ -83,11 +83,29 @@ include("head.inc");
?>
/* Called by the AJAX updater */
function format_log_line(row) {
- var i = 0;
- var line = '<td class="listMRlr nowrap" align="center">' + row[i++] + '<\/td>';
- while (i < 6) {
- line += '<td class="listMRr nowrap">' + row[i++] + '<\/td>';
+ if ( row[8] == '6' ) {
+ srcIP = '[' + row[3] + ']';
+ dstIP = '[' + row[5] + ']';
+ } else {
+ srcIP = row[3];
+ dstIP = row[5];
}
+
+ if ( row[4] == '' )
+ srcPort = '';
+ else
+ srcPort = ':' + row[4];
+ if ( row[6] == '' )
+ dstPort = '';
+ else
+ dstPort = ':' + row[6];
+
+ var line = '<td class="listMRlr" align="center">' + row[0] + '</td>' +
+ '<td class="listMRr nowrap">' + row[1] + '</td>' +
+ '<td class="listMRr nowrap">' + row[2] + '</td>' +
+ '<td class="listMRr nowrap">' + srcIP + srcPort + '</td>' +
+ '<td class="listMRr nowrap">' + dstIP + dstPort + '</td>' +
+ '<td class="listMRr nowrap">' + row[7] + '</td>';
return line;
}
//]]>
@@ -145,7 +163,25 @@ include("head.inc");
$rowIndex = 0;
foreach ($filterlog as $filterent):
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
- $rowIndex++;?>
+ $rowIndex++;
+ if ($filterent['version'] == '6') {
+ $srcIP = "[" . htmlspecialchars($filterent['srcip']) . "]";
+ $dstIP = "[" . htmlspecialchars($filterent['dstip']) . "]";
+ } else {
+ $srcIP = htmlspecialchars($filterent['srcip']);
+ $dstIP = htmlspecialchars($filterent['dstip']);
+ }
+
+ if ($filterent['srcport'])
+ $srcPort = ":" . htmlspecialchars($filterent['srcport']);
+ else
+ $srcPort = "";
+
+ if ($filterent['dstport'])
+ $dstPort = ":" . htmlspecialchars($filterent['dstport']);
+ else
+ $dstPort = "";
+ ?>
<tr class="<?=$evenRowClass?>">
<td class="listMRlr nowrap" align="center">
<a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);">
@@ -154,8 +190,8 @@ include("head.inc");
</td>
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['interface']);?></td>
- <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['src']);?></td>
- <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['dst']);?></td>
+ <td class="listMRr nowrap"><?php echo $srcIP . $srcPort;?></td>
+ <td class="listMRr nowrap"><?php echo $dstIP . $dstPort;?></td>
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
@@ -163,7 +199,6 @@ include("head.inc");
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
</tr>
<?php endforeach; ?>
- <tr style="display:none;"><td></td></tr>
</tbody>
</table>
</div>
OpenPOWER on IntegriCloud