Updating Multipe variables with one SQL Query

Richard J Palmer richard at merula.net
Sun Apr 7 17:07:35 CEST 2019


Hi

Following on from yesterdays ippool query - I have had an issue with 
Session being updated & freed


The cause it seems is what the Interim updates send to Freeradius - 
the Router (a firebrick LNS server) basically sends back just the 
'variables' that have changed, the unique ID and the accounting 
session ID. This is find for accounting updates - however with pools I 
need the IP address / calling-station-ID etc - these are not returned.

I can get round that in pre-acc by running:

update request {
                        User-Name := "%{sql1:SELECT UserName from 
radius..radacct WITH(NOLOCK) where AcctSessionId = 
'%{Acct-Session-Id}' AND NASIPAddress = '%{NAS-IP-Address}'}"
                        Framed-IP-Address := "%{sql1:SELECT 
FramedIPAddress from radius..radacct WITH(NOLOCK) where AcctSessionId 
= '%{Acct-Session-Id}' AND NASIPAddress = '%{NAS-IP-Address}'}"
                        Calling-Station-Id := "%{sql1:SELECT 
CallingStationId from radius..radacct WITH(NOLOCK) where AcctSessionId 
= '%{Acct-Session-Id}' AND NASIPAddress = '%{NAS-IP-Address}'}"

                }


The query itself is very quick  however that is having to run the same 
query three times to get the separate variables

I can think of several ways to get round this (create this as a long 
string I pass into three parts etc ... However before I think of that 
- is there a built in way to return the three columns from sql and 
then within FreeRadius and  assign them into the items as need be.

Thanks again in advance



Richard Palmer | Director | Merula Limited
Company Registered in England and Wales No. 3243995
5 Avro Court, Huntingdon, Cambridgeshire, PE29 6XS
Phone 01480 222940 | Support 0845 330 0666
Support Email support at merula.net



More information about the Freeradius-Users mailing list