Fix to CISCO_ACCOUNTING_HACK

Pavel Levshin pavel at levshin.spb.ru
Sun Oct 11 17:16:06 CEST 2009


Hi all.

We had some random crashes while processing ~600 RPS of accounting with 
freeradius 2.1.7 and rlm_sql (MySQL).

Coredumps showed that crashes occurs mostly in MySQL library. MySQL 
handle was used twice by different threads. Problem is so simple that I 
wonder why it has not been catched long ago. Here comes a patch:

--- freeradius-server-2.1.7/src/modules/rlm_sql/rlm_sql.c       
2009-09-14 10:43:29.000000000 -0400
+++ freeradius-server-2.1.7-patched/src/modules/rlm_sql/rlm_sql.c       
2009-10-11 15:03:12.000000000 -0400
@@ -1323,7 +1323,7 @@
                                                       
radius_xlat(logstr, sizeof(logstr), "stop packet with zero session 
length. [user '%{User-Name}', nas '%{NAS-IP-Address}']", request, NULL);
                                                       
radlog_request(L_ERR, 0, request, "%s", logstr);
                                                       
sql_release_socket(inst, sqlsocket);
-                                                       ret = 
RLM_MODULE_NOOP;
+                                                       return 
RLM_MODULE_NOOP;
                                               }
#endif

Mutex is released in sql_release_socket, but socket is still used below. 
This is not what CISCO_ACCOUNTING_HACK is supposed to do. Processing 
should stop here.

It looks like this bug has been fixed in ic-radius 0.17 at 2001.


--
Pavel Levshin
OJSC "Megafon", North-West branch






More information about the Freeradius-Devel mailing list