diff options
author | Renato Botelho <garga@pfSense.org> | 2014-02-10 08:54:03 -0200 |
---|---|---|
committer | Renato Botelho <garga@pfSense.org> | 2014-02-10 08:54:03 -0200 |
commit | 6901d6af97920f816b4dfc1b6d7efebda0bd7633 (patch) | |
tree | 6dac496addc4c88c3af6a938e81a2f0b832664ac /usr/local | |
parent | 4b5554a8e639be1c1154aeeda152f6c78671b0bb (diff) | |
parent | 54995d41533a2abc63fc29ab07e0586634be1282 (diff) | |
download | pfsense-6901d6af97920f816b4dfc1b6d7efebda0bd7633.zip pfsense-6901d6af97920f816b4dfc1b6d7efebda0bd7633.tar.gz |
Merge pull request #909 from phil-davis/RELENG_2_1
Releng 2 1 Return all stats when all or remote is selected on Traffic Graph
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/bandwidth_by_ip.php | 29 | ||||
-rwxr-xr-x | usr/local/www/status_graph.php | 2 |
2 files changed, 23 insertions, 8 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php index 0140a74..3bad998 100755 --- a/usr/local/www/bandwidth_by_ip.php +++ b/usr/local/www/bandwidth_by_ip.php @@ -24,10 +24,27 @@ 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 local, remote or all IPs returned +$filter = $_GET['filter']; + +if ($filter == "") + $filter = "local"; + +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 +52,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 +71,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++){ @@ -67,9 +82,9 @@ for ($x=2; $x<12; $x++){ $emptyinfocounter = 1; if ($bandwidthinfo != "") { $infoarray = explode (":",$bandwidthinfo); - if (($filter == "") || - (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || - (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { + if (($filter == "all") || + (($filter == "local") && (ip_in_subnet($infoarray[0], $intsubnet))) || + (($filter == "remote") && (!ip_in_subnet($infoarray[0], $intsubnet)))) { if ($hostipformat == "") { $addrdata = $infoarray[0]; } else { @@ -93,7 +108,7 @@ for ($x=2; $x<12; $x++){ //mark that we collected information $someinfo = true; } - } + } } unset($bandwidthinfo, $_grb); unset($listedIPs); diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php index 2342700..f9cf9df 100755 --- a/usr/local/www/status_graph.php +++ b/usr/local/www/status_graph.php @@ -220,9 +220,9 @@ foreach ($ifdescrs as $ifn => $ifd) { </select> , Filter: <select id="filter" name="filter" class="formselect" style="z-index: -10;" onchange="document.form1.submit()"> - <option value="">All</option> <option value="local"<?php if ($curfilter == "local") echo " selected";?>>Local</option> <option value="remote"<?php if ($curfilter == "remote") echo " selected";?>>Remote</option> + <option value="all"<?php if ($curfilter == "all") echo " selected";?>>All</option> </select> , Display: <select id="hostipformat" name="hostipformat" class="formselect" style="z-index: -10;" onchange="document.form1.submit()"> |