modules instantiation

Doug Hardie bc979 at lafn.org
Sat Feb 20 03:36:14 CET 2010


On 19 February 2010, at 17:35, Latha Krishnamurthi wrote:

> 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.

Well, it sure seemed clear when I wrote it, but now I tend to agree that its a bit misleading.  Those words were lifted from the original version 1 document and perhaps something changed with version 2, but I don't recall any such changes.  In any case, it does need a revision.  

>  
> 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 ?)

Alan responded with something I was not aware of.  I suspect thats the way you need to go.

>  
> 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
> 
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html





More information about the Freeradius-Users mailing list