Re: [SOLVED] !!!!! Check_Item Is Always Equal To 0 When 2^32
Dear Matthew & Alan DeKok. Thank you ver very very much for your assistanc throughout. This worked !!!!! I am able to do it with help of your both. You guys are great. Honestly, it was not possible for me without you help. I will write the solution as one document to help others. Solution can manage & control up to 2TB per voucher / username. Once again, my special thanks to Alan D. & Matthew Regards RM-- On Thursday, October 24, 2013, Matthew Newton wrote:
On Thu, Oct 24, 2013 at 11:35:30AM +0000, Russell Mike wrote:
I can't make it any clearer than that.
thank you very very much, it is great explanation. Your response made many things very clearer. But did not work for me still. Perhaps my formula is wrong. Kindly help one more step further. Honestly, i have tried very hard, working on it for some weeks now without results. i.e. i want to set 6GB limit.
total bytes in 6GB = 805306368 total bytes in 4GB = 536870912
Not sure where you got these from.
6GB = 6 * 1024 * 1024 * 1024 = 4 * 1024^3 = 6442450944
6GB in binary is
0000000000000000000000000000000110000000000000000000000000000000
3210987654321098765432109876543210987654321098765432109876543210 6 5 4 3 2 1 0
So the lower 32 bits are:
10000000000000000000000000000000
and the upper 32 bits are:
00000000000000000000000000000001
The lower bits can be found by bitwise AND with (2^32)-1 (i.e. 32 ones):
$ python
6*(1024**3) & ((2**32)-1) 2147483648
The upper 32 bits by shifting right by 32 bits:
6*(1024**3) >> 32 1
So you want
i put 536870912 in ChilliSpot-Max-Input-Octets
this should be 2147483648;
i put 268435456 in ChilliSpot-Max-Input-Gigawords
This should be 1.
To confirm the numbers are correct, left-shift the gigawords by 32 bits, then add the octets. Should come back to the original value:
(1<<32) + 2147483648 6442450944 6*(1024**3) 6442450944
Matthew
-- Matthew Newton, Ph.D. <mcn4@le.ac.uk <javascript:;>>
Systems Specialist, Infrastructure Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom
For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk <javascript:;>> - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (1)
-
Russell Mike