Problems with freeradius 1.1.5 (2.0.0) 20070322 with postgresql (SIGHUP => segmentation fault)
Claudiu Filip
claudiu at globtel.ro
Thu Mar 22 19:00:00 CET 2007
Hello freeradius-devel,
I'm running Freeradius 20070322 snapshot with postgresql
backend. (I tried older versions too)
I have 3 questions for you, all related to $subject.
Everything is working fine (the radius is getting the nas
clients from the database, doing db auth/acct, etc.) until we
send a -HUP to the radiusd..
First one:
8x------8x-----
$ /radius/sbin/radiusd -fsX $ killall -HUP radiusd
rlm_sql (sql): Closing sqlsocket 4
rlm_sql (sql): Closing sqlsocket 3
rlm_sql (sql): Closing sqlsocket 2
rlm_sql (sql): Closing sqlsocket 1
rlm_sql (sql): Closing sqlsocket 0
read_config_files: reading realms
Thu Mar 22 16:21:23 2007 : Info: rlm_sql (sql): Driver rlm_sql_postgresql (module rlm_sql_postgresql) loaded and linked
Thu Mar 22 16:21:23 2007 : Info: rlm_sql (sql): Attempting to connect to radius at 127.0.0.1:5432/dbradius
Segmentation fault
No core file..
I solved this problem by commenting out the "we do other magic"
in mainconfig.c lines 1059->1064. This will disable debug level
change on the fly facility, it's not that important anyway
8x-----8x------
Second:
8x-----8x------
rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 3 , fields = 5
rlm_sql (sql): Read entry nasname=1.2.3.4,shortname=nume,secret=secret
rlm_sql (sql): Adding client 1.2.3.4 (nume) to clients list
Segmentation fault (core dumped)
#0 rbtree_insert (tree=0x7d4c4c55, Data=0x80025808) at rbtree.c:246
246 Current = tree->Root;
(gdb) bt
#0 rbtree_insert (tree=0x7d4c4c55, Data=0x80025808) at rbtree.c:246
#1 0x8000685d in client_add (clients=0x800fbb18, client=0x80025808) at client.c:231
#2 0xb7db29ca in rlm_sql_instantiate (conf=0x8012efc8, instance=0x7d4c4c55) at rlm_sql.c:347
#3 0x8000f77c in find_module_instance (modules=0x8012e5e0, instname=0x80130100 "sql") at modules.c:322
#4 0x80010243 in setup_modules (reload=1) at modules.c:917
#5 0x8000ed65 in read_mainconfig (reload=1) at mainconfig.c:1162
#6 0x80012dc0 in main (argc=2, argv=0xbfdb1a34) at radiusd.c:560
I add
DEBUG2("OLD: %p",(void *)old_clients);
DEBUG2("NEW: %p",(void *)clients);
right before
mainconfig.clients = clients;
clients_free(old_clients); in mainparse.c
Start radiusd -fsX
OLD: (nil)
NEW: 0x800fbb18
killall -HUP radiusd:
OLD: 0x800fbb18
NEW: 0x800fbb18
rlm_sql (sql): Adding client 1.2.3.4 (nume) to clients list
Segmentation fault (core dumped)
So, we free the same location..
I guess the problem is in the clients_parse_section which doesnt
return a new address space.
clients.c
- if (clients) return clients;
+ if (clients) clients_free(clients);
mainconfig.c
- clients_free(old_clients);
+ if ((void *)old_clients != (void *)clients)
+ clients_free(old_clients);
solved the problem.
Do I still need the clients_free(old_clients)?
8x----------8x------------
Three:
8x------------------------
There is any other way to make the radius re-reread its
clients from database, without an expensive HUP (and not so easy
to send when you add entries to db)?
8x------------------------
Thanks for scrolling this down..
Best wishes,
Claudiu FILIP
claudiu at globtel.ro Phone : +40344880100
http://www.globtel.ro Fax: +40344880113
More information about the Freeradius-Devel
mailing list