diff options
author | Ermal Luçi <eri@pfsense.org> | 2013-04-11 23:47:32 -0700 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2013-04-11 23:47:32 -0700 |
commit | 9a2d3fc164d8246c809082ed750df9b121b4ad47 (patch) | |
tree | 3dc69a6d1c46e98a7e845fe02f5d8908788e4be2 /usr/local/captiveportal | |
parent | 4b3a2e1471981251213316b097459b74f9da220c (diff) | |
parent | c8b07434e3a1c9ae905c2e6cbef6f8fb25e3db00 (diff) | |
download | pfsense-9a2d3fc164d8246c809082ed750df9b121b4ad47.zip pfsense-9a2d3fc164d8246c809082ed750df9b121b4ad47.tar.gz |
Merge pull request #556 from tuyan/c8b07434e3a1c9ae905c2e6cbef6f8fb25e3db00
Fix calculation of accounting gigawords.
Diffstat (limited to 'usr/local/captiveportal')
-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 4a167e7..e43a188 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 @@ -319,7 +320,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)) { @@ -333,7 +334,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; |