Problems with rlm_sql module / drivers on Sparc 64

Andrew Mattie amattie at chilitech.net
Thu Oct 27 20:02:20 CEST 2005


Hello all. I'm having some problems getting FreeRADIUS on a Sparc 64
(E450) to successfully query our MS SQL 2000 database through FreeTDS
and through one of the ODBC modules. I've tried both rlm_sql_iodbc and
rlm_sql_unixodbc, but I haven't had any luck getting either of them to
work on this particular arch / system. However, I _have_ gotten
FreeRADIUS to work wonderfully using the same exact config files and
UnixODBC on an x86 system. I'm using Linux (Gentoo, not that it really
matters) and FreeRADIUS v 1.0.5 on both machines. Accoring to
rlm_sql.c, I'm using v 1.131.2.4 of the module.

First, I try to rlm_sql_iodbc driver. When I start the server in debug
mode on the Sparc, I get the following output and then the server
shuts down.

*snip*
rlm_sql (sql): Driver rlm_sql_iodbc (module rlm_sql_iodbc) loaded and linked
rlm_sql (sql): Attempting to connect to CustomerRadius@:/Emerald4
rlm_sql (sql): starting 0
rlm_sql (sql): Attempting to connect rlm_sql_iodbc #0
sql_create_socket: SQLConnectfailed:
rlm_sql (sql): Failed to connect DB handle #0
rlm_sql (sql): starting 1
rlm_sql (sql): starting 2
rlm_sql (sql): starting 3
rlm_sql (sql): starting 4
rlm_sql (sql): Failed to connect to any SQL server.
rlm_sql (sql): - generate_sql_clients
rlm_sql (sql): Query: SELECT * FROM fRadClients
rlm_sql (sql): Ignoring unconnected handle 4..
rlm_sql (sql): Ignoring unconnected handle 3..
rlm_sql (sql): Ignoring unconnected handle 2..
rlm_sql (sql): Ignoring unconnected handle 1..
rlm_sql (sql): Ignoring unconnected handle 0..
rlm_sql (sql): There are no DB handles to use! skipped 5, tried to connect 0
rlm_sql (sql): generate_sql_clients() returned error
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
radiusd.conf[10]: sql: Module instantiation failed.
nitrogen raddb #

The query it fails on is trying to grab the RADIUS client list from
the database. I get the same exact errors on my x86 system using the
iodbc driver, so I'm not sure that the problem is architecture
dependent.

I should point out here that I am able to use the 'iodbctest' program
that comes with the libiodbc package to query the database using the
same query, DSN, and username without problems. I initially thought it
was a problem with FreeRADIUS and libiodbc since it failed on both of
my architectures, but a x86 Debian box with FreeRADIUS 1.0.2 seems to
work fine with libiodbc. I'm not sure what's relevantly different
between the two installations other than a newer version of FreeRADIUS
on the installation, so maybe someone could help me out with this
problem.

Next, I try the rlm_sql_unixodbc driver. Like I said, it works
flawlessly on my x86 box, but using it on the Sparc results in a quick
consumption of all of the memory on the machine (1 GB) and a
subsequent FreeRADIUS crash. Here's what I'm seeing:

*snip*
rlm_sql (sql): Driver rlm_sql_unixodbc (module rlm_sql_unixodbc)
loaded and linked
rlm_sql (sql): Attempting to connect to CustomerRadius at Emerald4:/
rlm_sql (sql): starting 0
rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #0
rlm_sql (sql): Connected new DB handle, #0
rlm_sql (sql): starting 1
rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #1
rlm_sql (sql): Connected new DB handle, #1
rlm_sql (sql): starting 2
rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #2
rlm_sql (sql): Connected new DB handle, #2
rlm_sql (sql): starting 3
rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #3
rlm_sql (sql): Connected new DB handle, #3
rlm_sql (sql): starting 4
rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #4
rlm_sql (sql): Connected new DB handle, #4
rlm_sql (sql): - generate_sql_clients
rlm_sql (sql): Query: SELECT * FROM fRadClients
rlm_sql (sql): Reserving sql socket id: 4
no memory
nitrogen raddb #

UnixODBC also includes a program to test out the DSN, username, and
query. The program, 'isql,' works perfectly with the given query on
both machines and returns the desired results. I'm assuming then that
this may be an architecture-dependent problem with either the rlm_sql
module or rlm_sql_unixodbc driver.

One thing you might notice between the two outputs is that the second
line is subtly different in each. From what I've found in setting up
the Debian box is that the rlm_sql_iodbc driver looks at the
'radius_db' variable for the name of the DSN. On the other hand,
rlm_sql_unixodbc looks at a completely different variable, the
'server' variable, for the name of the DSN! It took me quite some time
to figure out that it used two different fields for the different
drivers, but experience tells me that it's true. Sure enough,
examining sql_iodbc.c:82 looks like it uses config->sql_db (equivalent
to radius_db?) for the DSN name and sql_unixodbc.c:93 looks like it
uses config->sql_server (equivalent to server?). Just though I'd let
anyone trying to get this working know about it.

Anyway, I really don't care which SQL driver I use as long as it
works. Anyone have any ideas?




More information about the Freeradius-Users mailing list