modules instantiation

Latha Krishnamurthi latha_vgopal at yahoo.com
Sat Feb 20 02:35:19 CET 2010


Thankyou very much for your prompt reply. I was referring to this documentation.
 
http://wiki.freeradius.org/Modules2

>>The xxx_instantiate module is called each time a new instance is started. Generally this >>module is used to establish the data for the instance that needs to be retained during the >>life of the instance. For example, reading the configuration variables. cf_section_parse>>(conf, data, module_config) is used to do this function. 
 
>>Setup struct rlm_xxx_t to hold data that needs to be accessed by all instances of the >>rlm. This data is not necessarily the same for each instance. There is a separate copy >>for each instance. For example, this is the place to store configuration variables that will >>be provided in FreeRADIUS.conf.
 
It is described like I can have the module specific data in the instance and use it in the life time of the instance. 
 
So if I need to use a unique socket connection for each thread, I have no place to store the instance specific data ? I need to have a global pool and lock it with mutex ?? (looks like rlm_ldap does something similar ?)
 
Thanks in advance
LK
 
--- On Fri, 2/19/10, Doug Hardie <bc979 at lafn.org> wrote:


From: Doug Hardie <bc979 at lafn.org>
Subject: Re: modules instantiation
To: "FreeRadius users mailing list" <freeradius-users at lists.freeradius.org>
Date: Friday, February 19, 2010, 3:49 PM



On 19 February 2010, at 15:24, Latha Krishnamurthi wrote:
> 
> I am using the free radius 2.1.3. I have a module rlm_xxx and have initialized it as thread safe. I have configured the start_servers as 3. The issue I am having is as follows.
>  
> I see that a new instance is getting created when the first one is busy handling a request. (I do this this by adding a sleep in the module and printing the threadid) I am expecting the xxx_instantiate function to get called each time a new instance is created (reading in the documentation). This does not happen. I am actually connecting to a server in the instantiate function and storing the socket id in the *instance, so that I can use it later in the authenticate etc.
>  
> But it seems that the socket id is the same for all the instances. *instance seems to be shared by all the instances ??
>  
> Am I missing something/configuration, your help is grately appreciated.

I believe this is an issue of terminology.  Instantiation in this case refers to the configuration process prior to the start of the server accepting Radius requests.  It does not refer to instantiation of new threads.  I am not aware of any hook you can use for instatiation of new threads.  In one of the older version rlm_example files is the following comment:

*      If the module needs to temporarily modify it's instantiation
*      data, the type should be changed to RLM_TYPE_THREAD_UNSAFE.
*      The server will then take care of ensuring that the module
*      is single-threaded.



-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20100219/e8efeb08/attachment.html>


More information about the Freeradius-Users mailing list