Issue with a new module and radiusd: symbol lookup error
Hi everybody, I'm using a self compiled version of FreeRADIUS 2.1.0 on a Linux x86 box running ubuntu 8.04 updated. I've been able to succesfully install and configure the server and to run some test using a D-Link access-point getting a regular Access- Accept. My troubles started when I decided to implement a new module. My module has a structure similar to the sql module in fact it is used to query a MySQL database. I have been able to make this module connect to the database and to perform some operation on the reply packet during the postauth phase (basically adding attributes). I also wanted to use this module, rlm_wimax_qos, in the authorize phase but here I got stuck because a symbol lookup error. I'm providing all the details I can, first of all the final part of radiusd -X command: Module: Linked to module rlm_wimax_qos Module: Instantiating wimax_qos wimax_qos { driver = "rlm_sql_mysql" server = "localhost" port = "" login = "root" password = "rootpass" radius_db = "radiusDB" read_groups = yes sqltrace = no sqltracefile = "/usr/local/var/log/radius/sqltrace.sql" readclients = no deletestalesessions = yes num_sql_socks = 5 sql_user_name = "%{User-Name}" default_user_profile = "" nas_query = "SELECT id,nasname,shortname,type,secret FROM nas" authorize_check_query = "" authorize_reply_query = "" authorize_group_check_query = "" authorize_group_reply_query = "" accounting_onoff_query = "" accounting_update_query = "" accounting_update_query_alt = "" accounting_start_query = "" accounting_start_query_alt = "" accounting_stop_query = "" accounting_stop_query_alt = "" connect_failure_retry_delay = 60 simul_count_query = "" simul_verify_query = "" postauth_query = "INSERT into radpostauth (user, pass, reply, date) values ('%{User-Name}', '%{User-Password:-Chap-Password}', '% {reply:Packet-Type}', NOW())" qos_profile_query = "SELECT qos_id FROM class_table WHERE EAP_Inner_GID='%{reply:EAP-Inner-GID}' AND EAP_Outer_GID='%{reply:EAP- Outer-GID}'" qos_get_attribute_query = "SELECT id,qos_id,attribute,value,op FROM qos_profile_table WHERE qos_id=%{reply:Qos_Id}" nas_capability_query = "SELECT NAS_DHCP_Support,DHCP_Proxy_Relay,MIP_FA_Address,type,nasname FROM nas_table WHERE nasname='%{NAS-IP-Address}'" dhcp_sec_assoc_query = "SELECT DHCP_RK_Key_ID,DHCP_RK_Lifetime,DHCP_RK FROM dhcp_handling_table WHERE DHCPv4_Server='%{reply:WiMAX-DHCPv4-Server}'" dhcp_sec_existid_query = "SELECT DHCP_RK_Key_ID,DHCP_RK_Lifetime,DHCP_RK FROM dhcp_handling_table WHERE DHCP_RK_Key_ID ='%{packet:WiMAX-DHCP-RK-Key-Id}'" dhcp_sec_update_query = "INSERT INTO dhcp_handling_table (DHCPv4_Server,DHCP_RK_Key_ID,DHCP_RK_Lifetime,DHCP_RK) VALUES ('% {reply:WiMAX-DHCPv4-Server}','%{reply:gen_WiMAX-DHCP-RK-Key-ID}','% {reply:gen_WiMAX-DHCP-RK-Lifetime}','%{reply:gen_WiMAX-DHCP-RK}')" dhcp_rm_old_key_query = "DELETE FROM dhcp_handling_table WHERE DHCPv4_Server='%{reply:WiMAX-DHCPv4-Server}'" static_only_config = "1" dhcp_rk_timeout = "36000" safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" } rlm_sql (wimax_qos): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (wimax_qos): Attempting to connect to root@localhost:/radiusDB radiusd: symbol lookup error: /usr/local/lib/rlm_wimax_qos-2.1.0.so: undefined symbol: sql_init_socketpool Then I'm also providing the relevant portion of the radiusd.conf file. Please note that no problems occur if I only "call" the module during postauth. In this phase the module's behaviour is the one expected. authorize { preprocess auth_log wimax_qos eap } authenticate { eap mschap } preacct { preprocess acct_unique suffix files } accounting { detail radutmp sql } session { radutmp sql } post-auth { wimax_qos } Finally I can provide the last part of the module code, the one where I set the function that serves as an entry point during the authorize phase. module_t rlm_wimax_qos = { RLM_MODULE_INIT, "wimax_qos", RLM_TYPE_THREAD_SAFE, /* type */ wimax_qos_instantiate, /* instantiation */ wimax_qos_detach, /* detach */ { NULL, /* authentication */ wimax_qos_authorize, /* authorization */ NULL, /* preaccounting */ NULL, /* accounting */ NULL, /* checksimul */ NULL, /* pre-proxy */ NULL, /* post-proxy */ wimax_qos_postauth, /* post-auth */ }, }; I have tried by best to understand where the error below comes from. Compiling goes fine, no errors are found. If I put the module under authorize in radiusd.conf the error happen, otherwise everything is going fine (but nothing of what i want is performed during authorize). I'm keeping saying this because I want to point out that the issue is configuration dependent and that my code works in certain circumstances (i.e. the symbol is not missing from the dynamic library). rlm_sql (wimax_qos): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (wimax_qos): Attempting to connect to root@localhost:/radiusDB radiusd: symbol lookup error: /usr/local/lib/rlm_wimax_qos-2.1.0.so: undefined symbol: sql_init_socketpool If someone has a clue everything is welcome, and If more details are needed I can do my best to provide them. Thank you, Lu
Luca Adamo wrote:
My troubles started when I decided to implement a new module. My module has a structure similar to the sql module in fact it is used to query a MySQL database. I have been able to make this module connect to the database and to perform some operation on the reply packet during the postauth phase (basically adding attributes).
Source code questions usually belong on freeradius-devel.
I also wanted to use this module, rlm_wimax_qos, in the authorize phase but here I got stuck because a symbol lookup error. ... /rlm_sql (wimax_qos): Attempting to connect to root@localhost:/radiusDB/ /radiusd: symbol lookup error: /usr/local/lib/rlm_wimax_qos-2.1.0.so: undefined symbol: sql_init_socketpool/
You've deleted that function from the module source code. Don't do that.
If someone has a clue everything is welcome, and If more details are needed I can do my best to provide them.
You don't need to edit the source code to change the SQL schema or queries. Just change the SQL schema and queries in the configuration files. That's why the queries are in text form: to let you edit them. Could you post the schema you're using, and a high-level description of what you are trying to do? Alan DeKok.
Il giorno 23/set/08, alle ore 14:36, Alan DeKok ha scritto:
Source code questions usually belong on freeradius-devel.
You don't need to edit the source code to change the SQL schema or queries. Just change the SQL schema and queries in the configuration files. That's why the queries are in text form: to let you edit them.
Could you post the schema you're using, and a high-level description of what you are trying to do?
I'm moving this discussion there. I've got the subscription a few seconds ago. I'm also trying to put the source code of that function from sql.c to my module. I'll post schema and high-level description in a minute. Luca
Luca Adamo wrote:
I'm also trying to put the source code of that function from sql.c to my module.
I would suggest *not* re-writing the SQL module. Instead, look at rlm_sqlippool in git.freeradius.org. It leverages an existing SQL module to do additional queries. It means that you don't have to duplicate all of the functionality of rlm_sql. And you don't have to duplicate all of the MySQL/PostgreSQL/Oracle/etc drivers, either. Plus, rlm_sqlippool.c is a *lot* easier to understand than rlm_sql. Alan DeKok.
participants (2)
-
Alan DeKok -
Luca Adamo