summaryrefslogtreecommitdiffstats
path: root/usr/local/www/bandwidth_by_ip.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2014-02-08 07:41:03 -0800
committerPhil Davis <phil.davis@world.inf.org>2014-02-08 07:41:03 -0800
commit5177b583ebeb4c01f24da588448b1143b252fc12 (patch)
tree7a5948b76581c15e57ef826d34b76d51cda9f7c1 /usr/local/www/bandwidth_by_ip.php
parent59c6e2181f4c95eb68c9ef909b2675bea1d4ec8f (diff)
downloadpfsense-5177b583ebeb4c01f24da588448b1143b252fc12.zip
pfsense-5177b583ebeb4c01f24da588448b1143b252fc12.tar.gz
Return all when all or remote is selected on Traffic Graph
Diffstat (limited to 'usr/local/www/bandwidth_by_ip.php')
-rwxr-xr-xusr/local/www/bandwidth_by_ip.php24
1 files changed, 18 insertions, 6 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php
index 0140a74..9fd996a 100755
--- a/usr/local/www/bandwidth_by_ip.php
+++ b/usr/local/www/bandwidth_by_ip.php
@@ -24,10 +24,24 @@ if (!does_interface_exist($real_interface)) {
echo gettext("Wrong Interface");
return;
}
+
$intip = find_interface_ip($real_interface);
//get interface subnet
$netmask = find_interface_subnet($real_interface);
$intsubnet = gen_subnet($intip, $netmask) . "/$netmask";
+
+// see if they want all, local or remote IPs returned
+$filter = $_GET['filter'];
+
+if ($filter == "local") {
+ $ratesubnet = "-c " . $intsubnet;
+} else {
+ // Tell the rate utility to consider the whole internet (0.0.0.0/0)
+ // and to consider local "l" traffic - i.e. traffic within the whole internet
+ // then we can filter the resulting output as we wish below.
+ $ratesubnet = "-lc 0.0.0.0/0";
+}
+
//get the sort method
$sort = $_GET['sort'];
if ($sort == "out")
@@ -35,8 +49,6 @@ 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();
@@ -56,7 +68,7 @@ if (($hostipformat != "") && (!isset($config['dnsmasq']['enable']) || !isset($co
}
}
-$_grb = exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 {$sort_method} -c {$intsubnet} | tr \"|\" \" \" | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $4, $6, $8 }'", $listedIPs);
+$_grb = exec("/usr/local/bin/rate -i {$real_interface} -nlq 1 -Aba 20 {$sort_method} {$ratesubnet} | tr \"|\" \" \" | awk '{ printf \"%s:%s:%s:%s:%s\\n\", $1, $2, $4, $6, $8 }'", $listedIPs);
$someinfo = false;
for ($x=2; $x<12; $x++){
@@ -68,8 +80,8 @@ for ($x=2; $x<12; $x++){
if ($bandwidthinfo != "") {
$infoarray = explode (":",$bandwidthinfo);
if (($filter == "") ||
- (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) ||
- (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) {
+ (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) ||
+ (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) {
if ($hostipformat == "") {
$addrdata = $infoarray[0];
} else {
@@ -93,7 +105,7 @@ for ($x=2; $x<12; $x++){
//mark that we collected information
$someinfo = true;
}
- }
+ }
}
unset($bandwidthinfo, $_grb);
unset($listedIPs);
OpenPOWER on IntegriCloud