diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-02-19 08:41:57 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-02-19 08:41:57 -0300 |
commit | 1fea5ad99e477822675b2ba1edf10c34834fe55c (patch) | |
tree | a79fe79326dfbfc2eba62295f343480e89279c2c /usr/local/www | |
parent | 30a9067275e734fd4a9c5f95b35edbf8ea613290 (diff) | |
download | pfsense-1fea5ad99e477822675b2ba1edf10c34834fe55c.zip pfsense-1fea5ad99e477822675b2ba1edf10c34834fe55c.tar.gz |
Get the correct interface subnet
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/bandwidth_by_ip.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/usr/local/www/bandwidth_by_ip.php b/usr/local/www/bandwidth_by_ip.php index ada7209..8e6b11d 100755 --- a/usr/local/www/bandwidth_by_ip.php +++ b/usr/local/www/bandwidth_by_ip.php @@ -22,24 +22,16 @@ $interface = $_GET['if']; $real_interface = convert_friendly_interface_to_real_interface_name($interface); $intip = find_interface_ip($real_interface); $intip = explode (".", $intip); -//get interface netmask +//get interface subnet $netmask = find_interface_subnet($real_interface); +$intsubnet = gen_subnet(find_interface_ip($real_interface), $netmask) . "/$netmask"; //get the sort method $sort = $_GET['sort']; if ($sort == "out") {$sort_method = "-T";} else {$sort_method = "-R";} -//use the same class of the specified interface -if ($netmask >= 24) { - $intsubnet = $intip[0] . "." . $intip[1] . "." . $intip[2] . ".0/24"; -} -elseif ($netmask >=16){ - $intsubnet = $intip[0] . "." . $intip[1] . ".0.0/16"; -} -else { - $intsubnet = $intip[0] . ".0.0.0/8"; -} + 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); unset($bandwidthinfo); unset($receivebytesarray); |