(RADIATOR) How to pass arguments to hook?

Frank Danielson fdanielson at csky.com
Thu Aug 3 12:02:25 CDT 2006


Hi Jan-

You may want to look at DefineFormattedGlobalVar. This allows you to defince
varaibles in the confgi file which can be accessed inside a hook using
&main::getVariable(). There is an example of this in the goodies/hooks.txt
file.

Frank Danielson
Infrastructure Architect

ClearSky Mobile Media
56 E. Pine St.
Orlando, FL 32801
USA

fdanielson at csky.com

-----Original Message-----
From: Jan Tomasek [mailto:jan at tomasek.cz]
Sent: Thursday, August 03, 2006 10:43 AM
To: radiator at open.com.au
Subject: (RADIATOR) How to pass arguments to hook?


Hello,

I'm writing hook used in NoReplyHook which implements better fallback to 
backup servers. I need somehow pass arguments to that hook, but I'm 
unable to find elegant way. At this moment I'm using:


<Handler>
   # This is infact configuration for NoReplyHook used later
   PreAuthHook sub { \
      $main::dead_realm_timeout = 5*60; \
      @main::dead_realm_servers = ('r1nren.etest.cesnet.cz', \
				  'r2nren.etest.cesnet.cz'); };

         <AuthBy RADIUS>
                 RetryTimeout            1
                 Retries                 0
                 FailureBackoffTime      0

		NoReplyHook file:"/etc/radiator/chose-server.pl"
         </AuthBy>

         AddToReplyIfNotExist    Tunnel-Private-Group-ID=1:100
         AddToReply              Tunnel-Type=1:VLAN,\
                                 Tunnel-Medium-Type=1:Ether_802
</Handler>

It works, but it's not nice, it's abusing of PreAuthHook and code is 
called every time this Handler is executed. Is there better way?

I wan't to use 'choose-server.pl' hook on mupltiple Handlers but I wish 
to pass to it diferent list of servers to choose from.

Thanks for any sugestion on this
-- 
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/

--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.

--
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list