Redundant SQL servers accounting problem, FreeRadius 1.1.4

Alexander V. Klepikov klepikov_a at up.ua
Mon Mar 19 16:41:50 CET 2007


Hello, Alexander!
You wrote to All on Fri, 16 Mar 2007 17:23:19 +0200:

AVK> It looks like accounting module cannot properly make a connection
AVK> to SQL
AVK> server, but authorize module can. I found that with num_sql_socks
AVK> <= 2
AVK> FreeRadius works perfect, I made several tests stopping and
AVK> starting my SQL

Well, I think I found why FreeRadius crashes. Unconnected SQL socket is 
passed to sql_close function in module rlm_sql in function rlm_sql_query 
(src/modules/rlm_sql/sql.c line 499). Here is the patch:

=========Beginning of the citation==============
--- src/modules/rlm_sql/sql.c   Fri Aug 26 03:37:47 2005
+++ src/modules/rlm_sql/sql.c   Mon Mar 19 16:11:57 2007
@@ -496,6 +496,7 @@

        if (ret == SQL_DOWN) {
                /* close the socket that failed */
+               if (sqlsocket->state == sockconnected)
                (inst->module->sql_close)(sqlsocket, inst->config);

                /* reconnect the socket */

=========The end of the citation================

My tests shows that problem is gone. I hope I patched right piece of code :)

With best regards, Alexander V. Klepikov.  E-mail: klepikov_a at up.ua 




More information about the Freeradius-Users mailing list