diff options
author | Seth Mos <seth.mos@dds.nl> | 2011-08-29 09:59:04 +0200 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2011-08-29 09:59:04 +0200 |
commit | 96bddaf35a123249375e7698ff81f0b0942413d7 (patch) | |
tree | 2ab709611a92a10ec8e50804054c247361f87f1d /usr | |
parent | 181816f19087b46c16753b971b5acffe82c39b90 (diff) | |
download | pfsense-96bddaf35a123249375e7698ff81f0b0942413d7.zip pfsense-96bddaf35a123249375e7698ff81f0b0942413d7.tar.gz |
Add IPv6 love to diag states Summary. For Ticket #1816
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/diag_states_summary.php | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php index fa49563..e5ca55e 100644 --- a/usr/local/www/diag_states_summary.php +++ b/usr/local/www/diag_states_summary.php @@ -80,13 +80,39 @@ if(count($states) > 0) { $dstinfo = $ends[count($ends) - 1]; } - $parts = split(":", $srcinfo); - $srcip = trim($parts[0]); - $srcport = trim($parts[1]); + /* Handle IPv6 */ + $parts = explode(":", $srcinfo); + $partcount = count($parts) -1; + $partsip = $parts; + if($partcount == 1) { + array_pop($partsip); + } else { + $srcip = trim(preg_replace("/\[[0-9]+\]/i", "", implode(":", $partsip))); + } + if($partcount > 1) { + preg_match("/\[[0-9]+\]/i", $parts[$partcount], $matches); + $srcport = $matches[0]; + // $srcport = trim($parts[$partcount]); + } else { + $srcport = trim($parts[$partcount]); + } + - $parts = split(":", $dstinfo); - $dstip = trim($parts[0]); - $dstport = trim($parts[1]); + $parts = explode(":", $dstinfo); + $partsip = $parts; + $partcount = count($parts) -1; + if($partcount == 1) { + array_pop($partsip); + } else { + $dstip = trim(preg_replace("/\[[0-9]+\]/i", "", implode(":", $partsip))); + } + if($partcount > 1) { + preg_match("/\[[0-9]+\]/i", $parts[$partcount], $matches); + $dstport = $matches[0]; + // $dstport = trim($parts[$partcount]); + } else { + $dstport = trim($parts[$partcount]); + } addipinfo($srcipinfo, $srcip, $proto, $srcport, $dstport); addipinfo($dstipinfo, $dstip, $proto, $srcport, $dstport); |