diff options
author | Phil Davis <phil.davis@world.inf.org> | 2013-03-07 18:50:34 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2013-03-07 18:50:34 +0545 |
commit | a02ce2600ca47e3dc85bea420b276330200ae9df (patch) | |
tree | 049c6cba9988a07104602c562bfad3a81a23944c /usr/local/www/bandwidth_by_ip.php | |
parent | e17e1b8a40e979e9faf81bc908c7ef98077b0e84 (diff) | |
download | pfsense-a02ce2600ca47e3dc85bea420b276330200ae9df.zip pfsense-a02ce2600ca47e3dc85bea420b276330200ae9df.tar.gz |
Bandwidth by IP - allow filter by local and remote
Diffstat (limited to 'usr/local/www/bandwidth_by_ip.php')
-rwxr-xr-x | usr/local/www/bandwidth_by_ip.php | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php index 9079f8f..8f91489 100755 --- a/usr/local/www/bandwidth_by_ip.php +++ b/usr/local/www/bandwidth_by_ip.php @@ -35,6 +35,8 @@ if ($sort == "out") else {$sort_method = "-R";} +$filter = $_GET['filter']; + // get the desired format for displaying the host name or IP $hostipformat = $_GET['hostipformat']; $iplookup = array(); @@ -65,28 +67,32 @@ for ($x=2; $x<12; $x++){ $emptyinfocounter = 1; if ($bandwidthinfo != "") { $infoarray = explode (":",$bandwidthinfo); - if ($hostipformat == "") { - $addrdata = $infoarray[0]; - } else { - // $hostipformat is "hostname" or "fqdn" - $addrdata = gethostbyaddr($infoarray[0]); - if ($addrdata == $infoarray[0]) { - // gethostbyaddr() gave us back the IP address, so try the static mapping array - if ($iplookup[$infoarray[0]] != "") - $addrdata = $iplookup[$infoarray[0]]; + if (($filter == "") || + (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || + (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { + if ($hostipformat == "") { + $addrdata = $infoarray[0]; } else { - if ($hostipformat == "hostname") { - // Only pass back the first part of the name, not the FQDN. - $name_array = explode(".", $addrdata); - $addrdata = $name_array[0]; + // $hostipformat is "hostname" or "fqdn" + $addrdata = gethostbyaddr($infoarray[0]); + if ($addrdata == $infoarray[0]) { + // gethostbyaddr() gave us back the IP address, so try the static mapping array + if ($iplookup[$infoarray[0]] != "") + $addrdata = $iplookup[$infoarray[0]]; + } else { + if ($hostipformat == "hostname") { + // Only pass back the first part of the name, not the FQDN. + $name_array = explode(".", $addrdata); + $addrdata = $name_array[0]; + } } } - } - //print host information; - echo $addrdata . ";" . $infoarray[1] . ";" . $infoarray[2] . "|"; + //print host information; + echo $addrdata . ";" . $infoarray[1] . ";" . $infoarray[2] . "|"; - //mark that we collected information - $someinfo = true; + //mark that we collected information + $someinfo = true; + } } } unset($bandwidthinfo, $_grb); |