[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeradius-users
Subject:    Re: Mikrotik Rate Limit attribute from query.
From:       Nick Porter <nick () portercomputing ! co ! uk>
Date:       2022-10-13 7:21:39
Message-ID: efc84506-4bf1-c7c1-80f2-87c717789e7f () portercomputing ! co ! uk
[Download RAW message or body]

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
[Attachment #2 (multipart/mixed)]

[Attachment #4 (text/plain)]

The simplest method for that would be an SQL xlat.  Presuming your SQL 
module name is sql, something like:

update reply {
     &Mikrotik-Rate-Limit := "%{sql:SELECT CASE WHEN sync = 1 THEN 
REPLACE(CAST(idvelocidad as char) + 'K', ' ', '') ELSE 
REPLACE(CAST(idvelocidad /2 as char + 'K/' + CAST(idvelocidad as 
char)+'K', ' ', '') END FROM SubAccounts WHERE Login = '%{SQL-User-Name}'}"
}

On 13/10/2022 03:42, Carlos Botejara wrote:
> Hi All.
> I'm migrating ClearBox Radius Software to freeradius, And I need to pass
> the attribute Mikrotik-Rate-Limit via query.
>
> The Query for ClearBox is:
> "SELECT 'Mikrotik-Rate-Limit' AS Expr1, \
>    CASE WHEN sync = 1 THEN \
>     REPLACE(CAST(idvelocidad as char) + 'K',' ','') \
>     ELSE \
>     REPLACE(CAST(idvelocidad /2 as char)+'K/'+ CAST(idvelocidad  as
> char)+'K',' ','') \
>     END \
>     AS Expr2 \
>    FROM SubAccounts with(nolock) \
>    WHERE Login = '%{SQL-User-Name}'"
>
> This query takes the bandwidth of a table in the CRM software. If the
> client is a business (synchronization), the bandwidth is symmetric, but if
> the client is an ordinary client, the bandwidth is not symmetric and the
> upload bandwidth is divided by 2 and the upload bandwidth is divided by 2.
> download is integer.
>
> How can I keep this in freeradius and pass the parameter through a query?
>
> Thanks
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

-- 
Nick Porter


["OpenPGP_signature.asc" (application/pgp-signature)]

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

--===============5386762428742600473==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic