summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorMichael Newton <miken32@gmail.com>2013-02-01 15:10:55 -0800
committerMichael Newton <miken32@gmail.com>2013-02-01 15:22:10 -0800
commitf48abba23bdb216455b6505fec990dee8de7f57e (patch)
tree4d254a9a1bed643170c63841e822d123fc09fe10 /etc
parent720498a0443fe7f4f823d5742239bea954d10c86 (diff)
downloadpfsense-f48abba23bdb216455b6505fec990dee8de7f57e.zip
pfsense-f48abba23bdb216455b6505fec990dee8de7f57e.tar.gz
check for optional reversing of statistics
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/captiveportal.inc23
1 files changed, 18 insertions, 5 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index 2582ea0..e7e9e47 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1480,22 +1480,35 @@ function captiveportal_get_ipfw_passthru_ruleno($value) {
*/
function getVolume($ip) {
- global $cpzone;
+ global $config, $cpzone;
+ $reverse = empty($config['captiveportal'][$cpzone]['reverseacct']) ? false : true;
$volume = array();
// Initialize vars properly, since we don't want NULL vars
$volume['input_pkts'] = $volume['input_bytes'] = $volume['output_pkts'] = $volume['output_bytes'] = 0 ;
$ipfw = pfSense_ipfw_getTablestats($cpzone, 1, $ip);
if (is_array($ipfw)) {
- $volume['input_pkts'] = $ipfw['packets'];
- $volume['input_bytes'] = $ipfw['bytes'];
+ if ($reverse) {
+ $volume['output_pkts'] = $ipfw['packets'];
+ $volume['output_bytes'] = $ipfw['bytes'];
+ }
+ else {
+ $volume['input_pkts'] = $ipfw['packets'];
+ $volume['input_bytes'] = $ipfw['bytes'];
+ }
}
$ipfw = pfSense_ipfw_getTablestats($cpzone, 2, $ip);
if (is_array($ipfw)) {
- $volume['output_pkts'] = $ipfw['packets'];
- $volume['output_bytes'] = $ipfw['bytes'];
+ if ($reverse) {
+ $volume['input_pkts'] = $ipfw['packets'];
+ $volume['input_bytes'] = $ipfw['bytes'];
+ }
+ else {
+ $volume['output_pkts'] = $ipfw['packets'];
+ $volume['output_bytes'] = $ipfw['bytes'];
+ }
}
return $volume;
OpenPOWER on IntegriCloud