Is there way to convert output octets and input octets to KB

Mustafa Nassir mustafa.n.gaid at gmail.com
Sun Jun 16 13:56:00 CEST 2019


ok , i need to limit total octets for users so i add sqlcounter :

sqlcounter total_limit{
            counter_name = 'Max-Total-Bandwidth'
            check_name = 'Total-Bandwidth'
            sql_module_instance = sql
            key = 'User-Name'
            dialect = mysql
            reset = never
  query = "SELECT SUM(acctinputoctets) + SUM(acctoutputoctets) FROM radacct
WHERE UserName='%{${key}}'"
}

its work fine for 4 GB but if i need to limit it to 10 GB or more the
server give another value not what i add some examble :

insert into radcheck (username,attribute,op,value) values ("sw392","
Cleartext-Password",":=","sw");
insert into radcheck (username,attribute,op,value) values ("sw392","
Monthly-Bandwidth ",":="," 10737418240");

when i do radtest sw392 sw 127.0.0.1 10 XXXXX

i get

 User-Name = "sw392"
        User-Password = "sw"
        NAS-IP-Address = 127.0.0.1
        NAS-Port = 10
        Message-Authenticator = 0x00
        Cleartext-Password = "sw"
Received Access-Accept Id 61 from 127.0.0.1:1812 to 0.0.0.0:0 length 26
        Session-Timeout = 2147483648

the session-timeout is my Monthly-Bandwidth attribute as you see i get
different value from what i insert in sql

my freeradius V

radiusd: FreeRADIUS Version 3.0.13, for host x86_64-redhat-linux-gnu, built
on May 13 2019 at 19:48:02
FreeRADIUS Version 3.0.13
Copyright (C) 1999-2017 The FreeRADIUS server project and contributors

* i use default /etc/raddb/mods-config/sql/main/mysql/  ( schema / queries )

sorry for my bad language .

On Sun, Jun 16, 2019 at 2:33 PM Alan DeKok <aland at deployingradius.com>
wrote:

>
>
> > On Jun 16, 2019, at 7:29 AM, Mustafa Nassir <mustafa.n.gaid at gmail.com>
> wrote:
> >
> > Exactly, the first part of your reply is what happen in my case if I need
> > to use 64 bits how can I do that in freeradius ?
>
>   Use 64 bits WHERE?
>
>   And if you read my answer, you'll see that this isn't a problem.
> FreeRADIUS already does the right thing.
>
>   So which version are you using?  Are you using the default schema /
> queries?  What is going wrong?
>
>   You need to write better descriptions of what you're trying to do.  We
> can't read your mind.  We don't know what you're doing.  We don't know what
> you're thinking.
>
>   Explain yourself.  Learn how to ask good questions.  It's the only way
> to get a problem fixed.
>
>   Or, continue to send content-free vague messages to the list, at which
> point they will be ignored.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list