diff options
author | bcyrill <cyrill@bannwart.info> | 2012-04-12 19:29:08 +0300 |
---|---|---|
committer | bcyrill <cyrill@bannwart.info> | 2012-04-12 19:29:08 +0300 |
commit | 5a27a095e86502c9b0825d5a8434d5c4aebc8b94 (patch) | |
tree | b09db734fc9ca2f03a434cc70966b33311057438 /usr | |
parent | bd29bb7baa068cb92828461207ea35f74b6c2383 (diff) | |
download | pfsense-5a27a095e86502c9b0825d5a8434d5c4aebc8b94.zip pfsense-5a27a095e86502c9b0825d5a8434d5c4aebc8b94.tar.gz |
Fixed IPv4 regression. Handles addresses with and without port.
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/diag_states_summary.php | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php index e5ca55e..37c4243 100644 --- a/usr/local/www/diag_states_summary.php +++ b/usr/local/www/diag_states_summary.php @@ -82,36 +82,25 @@ if(count($states) > 0) { /* Handle IPv6 */ $parts = explode(":", $srcinfo); - $partcount = count($parts) -1; - $partsip = $parts; - if($partcount == 1) { - array_pop($partsip); + $partcount = count($parts); + if ($partcount <= 2) { + $srcip = trim($parts[0]); + $srcport = trim($parts[1]); } else { - $srcip = trim(preg_replace("/\[[0-9]+\]/i", "", implode(":", $partsip))); + preg_match("/([0-9a-f:]+)(\[([0-9]+)\])?/i", $srcinfo, $matches); + $srcip = $matches[1]; + $srcport = trim($matches[3]); } - if($partcount > 1) { - preg_match("/\[[0-9]+\]/i", $parts[$partcount], $matches); - $srcport = $matches[0]; - // $srcport = trim($parts[$partcount]); - } else { - $srcport = trim($parts[$partcount]); - } - - + $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]); + $partcount = count($parts); + if ($partcount <= 2) { + $dstip = trim($parts[0]); + $dstport = trim($parts[1]); } else { - $dstport = trim($parts[$partcount]); + preg_match("/([0-9a-f:]+)(\[([0-9]+)\])?/i", $dstinfo, $matches); + $dstip = $matches[1]; + $dstport = trim($matches[3]); } addipinfo($srcipinfo, $srcip, $proto, $srcport, $dstport); |