summaryrefslogtreecommitdiffstats
path: root/usr/local/www/widgets
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2014-12-21 17:48:35 +0545
committerPhil Davis <phil.davis@inf.org>2014-12-21 17:48:35 +0545
commitc120bd8da9cd31857572784202e1dca465970688 (patch)
tree89531106d1bfceb20167d8096e83e71a0251eaae /usr/local/www/widgets
parent319e126e12a6ff757942de7b84c76db440c10fa5 (diff)
downloadpfsense-c120bd8da9cd31857572784202e1dca465970688.zip
pfsense-c120bd8da9cd31857572784202e1dca465970688.tar.gz
Handle firewall log widget display formats
the same way for the initial display and for updated rows done by Java Script. Now we receive the source IP and port, destination IP and port, all in separate fields so they can be put together in whatever combination for display. IPv6 displayed addresses are shown inside "[ ]" so that any following port has the standard syntax like "[a:b::c:d]:123" - this makes it obvious that the last numbers are a port number, and not part of the IPv6 address. The "title" has IP+Port - that is displayed when hovering over the box in general. The href to diag_dns.php has hover text "Reverse Resolve with DNS" and the "?host=" sends just the IP address (without IPv6 square brackets). The text displayed in the link is the IP address (with square brackets if an IPv6 address). For the destination column, if there is a destinaion port, it is displayed in ordinary text ":port" after the IP address. The blank not-displayed row at the end of the table is removed - this fixes the problem with counting the rows of the table where rows would disappear at each update.
Diffstat (limited to 'usr/local/www/widgets')
-rw-r--r--usr/local/www/widgets/widgets/log.widget.php56
1 files changed, 46 insertions, 10 deletions
diff --git a/usr/local/www/widgets/widgets/log.widget.php b/usr/local/www/widgets/widgets/log.widget.php
index fb240fb..2677ee5 100644
--- a/usr/local/www/widgets/widgets/log.widget.php
+++ b/usr/local/www/widgets/widgets/log.widget.php
@@ -105,11 +105,30 @@ else
/* Called by the AJAX updater */
function format_log_line(row) {
- var line = '<td class="listMRlr" align="center">' + row[0] + '<\/td>' +
- '<td class="listMRr ellipsis" title="' + row[1] + '">' + row[1].slice(0,-3) + '<\/td>' +
- '<td class="listMRr ellipsis" title="' + row[2] + '">' + row[2] + '<\/td>' +
- '<td class="listMRr ellipsis" title="' + row[3] + '">' + row[3] + '<\/td>' +
- '<td class="listMRr ellipsis" title="' + row[4] + '">' + row[4] + '<\/td>';
+ var rrText = "<?php echo gettext("Reverse Resolve with DNS"); ?>";
+
+ 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 ellipsis" title="' + row[1] + '">' + row[1].slice(0,-3) + '</td>' +
+ '<td class="listMRr ellipsis" title="' + row[2] + '">' + row[2] + '</td>' +
+ '<td class="listMRr ellipsis" title="' + srcIP + srcPort + '"><a href="diag_dns.php?host=' + row[3] + '" title="' + rrText + '">' + srcIP + '</a></td>' +
+ '<td class="listMRr ellipsis" title="' + dstIP + dstPort + '"><a href="diag_dns.php?host=' + row[5] + '" title="' + rrText + '">' + dstIP + '</a>' + dstPort + '</td>';
var nentriesacts = "<?php echo $nentriesacts; ?>";
var nentriesinterfaces = "<?php echo $nentriesinterfaces; ?>";
@@ -188,6 +207,24 @@ function format_log_line(row) {
foreach ($filterlog as $filterent):
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
$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">
@@ -197,19 +234,18 @@ function format_log_line(row) {
</td>
<td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['time']);?>"><?php echo substr(htmlspecialchars($filterent['time']),0,-3);?></td>
<td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['interface']);?>"><?php echo htmlspecialchars($filterent['interface']);?></td>
- <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['src']);?>">
+ <td class="listMRr ellipsis nowrap" title="<?php echo $srcIP . $srcPort;?>">
<a href="diag_dns.php?host=<?php echo "{$filterent['srcip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>">
- <?php echo htmlspecialchars($filterent['srcip']);?></a></td>
- <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['dst']);?>">
+ <?php echo $srcIP;?></a></td>
+ <td class="listMRr ellipsis nowrap" title="<?php echo $dstIP . $dstPort;?>">
<a href="diag_dns.php?host=<?php echo "{$filterent['dstip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>">
- <?php echo htmlspecialchars($filterent['dstip']);?></a><?php echo ":" . htmlspecialchars($filterent['dstport']);?></td>
+ <?php echo $dstIP;?></a><?php echo $dstPort;?></td>
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
?>
</tr>
<?php endforeach; ?>
- <tr style="display:none;"><td></td></tr>
</tbody>
</table>
OpenPOWER on IntegriCloud