Bug #7835
closedfreeradius unit wrong for varusersmaxbandwidthup and varusersmaxbandwidthdown
0%
Description
When we add a new radius user, we can set Maximum Bandwidth Down/Up and in the help we can read:
Enter the maximum bandwidth for download in in kilobits per second (Kbps).
offtopic 'in' is repeated.
At the file /usr/local/pkg/freeradius.inc it will say the GUI uses KiloBit but it uses Kilobit.
and will multiply by 1024 when it should be 1000 // GUI uses KiloBit but RADIUS needs Bits so we do a multiplication
$varusersmaxbandwidthup = ($users['varusersmaxbandwidthup'] ?: '');
$varusersmaxbandwidthup = $varusersmaxbandwidthup * 1024;
$varusersmaxbandwidthdown = ($users['varusersmaxbandwidthdown'] ?: '');
$varusersmaxbandwidthdown = $varusersmaxbandwidthdown * 1024;
regards
Updated by Jim Pingle about 7 years ago
- Status changed from New to Not a Bug
There are 1024 bits in a kilobit. Not 1000. I'll fix the "in in" typo.
Updated by Azure it about 7 years ago
Jim Pingle wrote:
There are 1024 bits in a kilobit. Not 1000. I'll fix the "in in" typo.
Freebsd uses 1000 bits in 1 kilobit.
[[https://github.com/freebsd/freebsd/blob/master/usr.bin/systat/convtbl.c]]
#define BIT (8) #define BITS (1) #define KILOBIT (1000LL) #define MEGABIT (KILOBIT * 1000) #define GIGABIT (MEGABIT * 1000) #define TERABIT (GIGABIT * 1000) #define BYTE (1) #define BYTES (1) #define KILOBYTE (1024LL) #define MEGABYTE (KILOBYTE * 1024) #define GIGABYTE (MEGABYTE * 1024) #define TERABYTE (GIGABYTE * 1024)
This is explained at this freebsd patch from 2006:
[[https://lists.freebsd.org/pipermail/freebsd-bugs/2006-December/021240.html]]
wikipedia:
regards
Updated by Jim Pingle about 7 years ago
Then we can change the description to say kibibit instead. Changing the multiplier would result in people having an unexpected shift in the effect of their settings.
Updated by Kill Bill about 7 years ago
May I suggest "Enter the maximum bandwidth for download in Kbps" and moving on?