diff options
author | Tuyan Ozipek <tozipek@datavalet.com> | 2013-04-11 15:51:28 -0400 |
---|---|---|
committer | Tuyan Ozipek <tozipek@datavalet.com> | 2013-04-11 15:51:28 -0400 |
commit | c8b07434e3a1c9ae905c2e6cbef6f8fb25e3db00 (patch) | |
tree | f493ca873d8ef971575f7bc179f1bd29178488a3 /usr/local/captiveportal/radius_accounting.inc | |
parent | 17cf3d1783a43de1037744f981f2503acd50e047 (diff) | |
download | pfsense-c8b07434e3a1c9ae905c2e6cbef6f8fb25e3db00.zip pfsense-c8b07434e3a1c9ae905c2e6cbef6f8fb25e3db00.tar.gz |
Fixed PHP_INT_MAX not being 2^32 for accounting gigawords.
Diffstat (limited to 'usr/local/captiveportal/radius_accounting.inc')
-rw-r--r-- | usr/local/captiveportal/radius_accounting.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/local/captiveportal/radius_accounting.inc b/usr/local/captiveportal/radius_accounting.inc index 0a1300c..b0ae2f5 100644 --- a/usr/local/captiveportal/radius_accounting.inc +++ b/usr/local/captiveportal/radius_accounting.inc @@ -42,6 +42,7 @@ pfSense_MODULE: captiveportal */ +define('GIGAWORDS_RIGHT_OPERAND', '4294967296'); // 2^32 /** * Get the NAS-IP-Address based on the current wan address @@ -320,7 +321,7 @@ function gigawords($bytes) { */ // We use BCMath functions since normal integers don't work with so large numbers - $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , PHP_INT_MAX) ; + $gigawords = bcdiv( bcsub( $bytes, remainder($bytes) ) , GIGAWORDS_RIGHT_OPERAND) ; // We need to manually set this to a zero instead of NULL for put_int() safety if (is_null($gigawords)) { @@ -334,7 +335,7 @@ function gigawords($bytes) { function remainder($bytes) { // Calculate the bytes we are going to send to the radius - $bytes = bcmod($bytes, PHP_INT_MAX); + $bytes = bcmod($bytes, GIGAWORDS_RIGHT_OPERAND); if (is_null($bytes)) { $bytes = 0; |