global hash variable perl

Alexander Clouter alex at digriz.org.uk
Mon Feb 28 20:40:05 CET 2011


Vinh Nguyen <vhn2000 at gmail.com> wrote:
> 
> I don't think it will make a difference since the perl module is 
> instantiated for every request. Unless I mis-understood something.
>
It is instantiated only once in a mod_perl type of way.  If you want 
more instances, then you need to use threads (since instantiated once 
but freeradius will now run requests in parallel through your code, 
which might be:
 a) dangerous unless you know about thread safe coding
 b) un-neccessary as all you are doing is trying to build a 'hot cache'

Stack your code so that you call your caching module to populate 
attributes if possible, then use unlang to test if the cache module did 
it's thing, if it did not ('notfound') then call rlm_sql from 
FreeRADIUS.  Do *not* do it in the perl module otherwise you will run 
into threading related bottlenecks.

> Earlier I tried similar to what you suggested - without the {}. but it
> didn't work.
> 
I have no idea what is is meant to do, but it looks very wrong.

I use rlm_perl for caching some attributes in the same session, feel 
free to borrow from my example:

http://stuff.digriz.org.uk/cache_ldap-userdn.pm

As a second hint that will help you on your quest:

http://en.wikipedia.org/wiki/Bloom_filter
http://search.cpan.org/~mceglows/Bloom-Filter-1.0/Filter.pm

Cheers

-- 
Alexander Clouter
.sigmonster says: It takes all kinds to fill the freeways.
                  		-- Crazy Charlie




More information about the Freeradius-Users mailing list