RadAcct Issue

Alan DeKok aland at deployingradius.com
Wed Nov 3 22:16:37 CET 2021


On Nov 3, 2021, at 4:03 PM, Richard J Palmer <richard at merula.net> wrote:
> for some (not not all) session closes on RadAcct we are seeing:
> 
> (142) sql1: SQL-User-Name set to 'myusername at myrealm'
> (142) sql1: EXPAND EXECUTE radius.[dbo].[proc_RadacctUpdate_1] '%S', '%{Acct-Session-Time}', '%{Acct-Input-Gigawords}', '%{Acct-Input-Octets}', '%{Acct-Output-Gigawords}', '%{Acct-Output-Octets}', '%{Acct-Terminate-Cause}', '%{Acct-Delay-Time}', '%{Connect-Info}', '%{Acct-Session-Id}', '%{NAS-IP-Address}'
> (142) sql1:    --> EXECUTE radius.[dbo].[proc_RadacctUpdate_1] '2021-11-03 19:54:22', '2835', '0', '361059', '0', '357416', 'Lost-Carrier', '', '287000/396000', 'S600000269717108F60302', '1.2.3.4'
> (142) sql1: EXPAND /usr/local/var/log/radius/accounting.sql
> (142) sql1:    --> /usr/local/var/log/radius/accounting.sql
> (142) sql1: Executing query: EXECUTE radius.[dbo].[proc_RadacctUpdate_1] '2021-11-03 19:54:22', '2835', '0', '361059', '0', '357416', 'Lost-Carrier', '', '287000/396000', 'S600000269717108F60302', '1.2.3.4'
> (142) sql1: SQL query returned: success
> (142) sql1: -1 record(s) updated

  If that's what MS-SQL returns, then it's what FreeRADIUS gets.  It's hard to fix something in another library / server.

> Note this is using MS SQL via TDS
> 
> As this is not seeing a positive return from the numbers of records updated - then it does not reply to the NAS and so the NAS tries again and again

  Yes.  :(

> Running the Query on the MS SQL server I see:
> 
> ---
> (1 row affected)
> 
> (1 row affected)
> 
> ---
> 
> So it is correctly updating records - the stored procedure is safe as long as it returns success.

  Well, RADIUS does all kind of asynchronous updates to sessions.  So there's no guarantee that the session database is the same when you run the query, and when FreeRADIUS runs the query.

> 1) Can you think why FreeRadius is getting -1 as a return.

  The TDS / MS-SQL client library is returning that.

> 2) Given the stored procedure will return an error IF it can't update the data - is there anyway for us to tell FreeRadius to accept and process OK as long as the Query works.

  Except that the SQL library says the query *didn't* work.

> We are not seeing this for all queries - but just some - happy to add as many details as needed here - and it's not pointing the blame at Radius - just trying to understand the oddity for the future

  Which version of FreeRADIUS are you using?

  Alan DeKok.




More information about the Freeradius-Users mailing list