Check_Item Is Always Equal To 0 When 2^32
Hello FR Gurus Any idea ? If I put a value lesser than 2^32. i.e. 4294967290 for “ ChilliSpot-Max-Total-Octets” in radgroupcheck, value can be read by FreeRadius and check_item has the correct value (4294967290). If I put value bigger than 2^32, (8589934592) check_item is always equal to 0. Thanks / Regards RM--
Russell Mike wrote:
If I put a value lesser than 2^32. i.e. 4294967290 for “ChilliSpot-Max-Total-Octets” in radgroupcheck, value can be read by FreeRadius and check_item has the correct value (4294967290). If I put value bigger than 2^32, (8589934592) check_item is always equal to 0.
"integer" in RADIUS is 32-bits. So you can't get a number larger than 2^32-1 into ChilliSpot-Max-Total-Octets. You will need to use 64-bit counter. Alan DeKok.
On Tue, Oct 22, 2013 at 2:57 PM, Alan DeKok <aland@deployingradius.com>wrote:
Russell Mike wrote:
If I put a value lesser than 2^32. i.e. 4294967290 for “ChilliSpot-Max-Total-Octets” in radgroupcheck, value can be read by FreeRadius and check_item has the correct value (4294967290). If I put value bigger than 2^32, (8589934592) check_item is always equal to 0.
"integer" in RADIUS is 32-bits. So you can't get a number larger than 2^32-1 into ChilliSpot-Max-Total-Octets.
You will need to use 64-bit counter.
Alan DeKok.
Thanks Alan, i understand that, My NAS support Gigaword attribute, ChilliSpot-Max-Total-Octets-Gigaword should contain upper 32 bit value of 64 bit number. i am using ChilliSpot-Max-Total-Octets-Gigaword also. No? *Check: 8GB* ChilliSpot-Max-Input-Octets - Value 8589934592 ChilliSpot-Max-Input-Gigawords - Value 8589934592 *Reply: **8GB* ChilliSpot-Max-Input-Octets - Value 8589934592 ChilliSpot-Max-Input-Gigawords - Value 8589934592 which counter is 64 bit ? -
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Russell Mike wrote:
i understand that, My NAS support Gigaword attribute,ChilliSpot-Max-Total-Octets-Gigaword should contain upper 32 bit value of 64 bit number. i am using ChilliSpot-Max-Total-Octets-Gigaword also. No?
Yes.
*Check: 8GB* ChilliSpot-Max-Input-Octets - Value 8589934592 ChilliSpot-Max-Input-Gigawords - Value 8589934592
Uh... no.
which counter is 64 bit ?
Did you read what you wrote at the start of the message? This isn't rocket science. It's simple math. The "octets" attribute is the lower 32 bits of a 64-bit counter. The "gigawords" attribute is the upper 32 bits of a 64-bit counter. If you want to set a limit, write it down as a 64-bit number. Put the upper 32 bits into the "gigawords" attribute. Put the lower 32 bits into the "octets" attributes. I can't make it any clearer than that. Alan DeKok.
Hi Alan, I tried to communicate with you thru your email but I didn't get any response, did you receive my emails. Thanks, -----Original Message----- From: freeradius-users-bounces+yazan.jaber=newroztelecom.com@lists.freeradius.org [mailto:freeradius-users-bounces+yazan.jaber=newroztelecom.com@lists.freeradius.org] On Behalf Of Alan DeKok Sent: Tuesday, October 22, 2013 9:35 PM To: FreeRadius users mailing list Subject: Re: Check_Item Is Always Equal To 0 When 2^32 Russell Mike wrote:
i understand that, My NAS support Gigaword attribute,ChilliSpot-Max-Total-Octets-Gigaword should contain upper 32 bit value of 64 bit number. i am using ChilliSpot-Max-Total-Octets-Gigaword also. No?
Yes.
*Check: 8GB* ChilliSpot-Max-Input-Octets - Value 8589934592 ChilliSpot-Max-Input-Gigawords - Value 8589934592
Uh... no.
which counter is 64 bit ?
Did you read what you wrote at the start of the message? This isn't rocket science. It's simple math. The "octets" attribute is the lower 32 bits of a 64-bit counter. The "gigawords" attribute is the upper 32 bits of a 64-bit counter. If you want to set a limit, write it down as a 64-bit number. Put the upper 32 bits into the "gigawords" attribute. Put the lower 32 bits into the "octets" attributes. I can't make it any clearer than that. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Tue, Oct 22, 2013 at 6:34 PM, Alan DeKok <aland@deployingradius.com>wrote:
Russell Mike wrote:
i understand that, My NAS support Gigaword attribute,ChilliSpot-Max-Total-Octets-Gigaword should contain upper 32 bit value of 64 bit number. i am using ChilliSpot-Max-Total-Octets-Gigaword also. No?
Yes.
*Check: 8GB* ChilliSpot-Max-Input-Octets - Value 8589934592 ChilliSpot-Max-Input-Gigawords - Value 8589934592
Uh... no.
which counter is 64 bit ?
Did you read what you wrote at the start of the message? This isn't rocket science. It's simple math.
The "octets" attribute is the lower 32 bits of a 64-bit counter. The "gigawords" attribute is the upper 32 bits of a 64-bit counter.
If you want to set a limit, write it down as a 64-bit number. Put the upper 32 bits into the "gigawords" attribute. Put the lower 32 bits into the "octets" attributes.
I can't make it any clearer than that.
Dear Alan 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 i deducted 4GB bytes from 6GB bytes to get upper 32bit number = 268435456 i put 536870912 in ChilliSpot-Max-Input-Octets i put 268435456 in ChilliSpot-Max-Input-Gigawords *counters module: * sqlcounter *lower32_bitcounter* { counter-name = Acct-Input-Octets check-name = Acct-Input-Octets reply-name = Session-Timeout sqlmod-inst = sql key = User-Name reset = never cache-size = 5000 query = "SELECT (SUM(AcctInputOctets) + SUM(AcctOutputOctets)) FROM radacct WHERE UserName='%{%k}'" } sqlcounter *uper32_bitcounter* { counter-name = Acct-Input-Octets-Gigawords check-name = Acct-Input-Octets-Gigawords reply-name = Session-Timeout sqlmod-inst = sql key = User-Name reset = never cache-size = 5000 query = "SELECT (SUM(AcctInputOctets) + SUM(AcctOutputOctets)) FROM radacct WHERE UserName='%{%k}'" } Million Thanks RM --
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
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> 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>
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.
This reminds me my university time!
Russell Mike wrote:
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
i deducted 4GB bytes from 6GB bytes to get upper 32bit number = 268435456
Uh... no. This should be simple math. You need to DIVIDE by 2^32. Not SUBTRACT by 2^32. Please stop asking simple math questions here. Buy a calculator or a book. Alan DeKok.
participants (5)
-
Alan DeKok -
Matthew Newton -
Russell Mike -
Sergio NNX -
Yazan Jaber