(RADIATOR) Pre Handler hook help...
Hugh Irvine
hugh at open.com.au
Fri Jul 12 17:11:30 CDT 2002
Hello Robert -
I suggest you do two things:
1. put the hook code in a file so it is easier to edit - something like this:
PreHandlerHook file:"%D/nasport.pl"
2. unwind the code a bit and add print statements between the statements so
you can see what is going on
Then you can run radiusd from the command line and you will see the print
output in the terminal window where you are running it - like this:
radiusd -foreground -log_stdout -config_file .....
regards
Hugh
On Sat, 13 Jul 2002 06:21, Robert Blayzor wrote:
> We have an handler which uses the following hook:
>
> <Client 64.246.152.18>
> Identifier DSL1
> Secret shhhh
> DupInterval 2
> NasType ignore
> PreHandlerHook sub { ${$_[0]}->add_attr('NAS-Port-Type',
> 'SDSL'); my $i_p = ${$_[0]\
> }->get_attr('RB-NAS-Real-Port'); my $i_a = sprintf("%s/%s/%s.%s", map
> oct("0b$_"), unpack("\
> B32", pack("N", $i_p)) =~ /(.{5})(.{3})(.{8})(.*)/);
> ${$_[0]}->add_attr('Calling-Station-Id\
> ', $i_a);}
> </Client>
>
>
> In a nutshell the Hander basically adds a NAS-Port-Type and is to take a
> 32bit integer representation of DSL ports and put them in the
> 'Calling-Station-Id' attribute.
>
> The output should come out to be soething like: 5/0/0/233, etc.
> However everything comes out at 0/0/0.0, like $i_p is null, but it's not
> because the following code (if I reverse things) works fine...
>
> PreHandlerHook sub { ${$_[0]}->add_attr('NAS-Port-Type',
> 'SDSL'); my $i_p = ${$_[0]\
> }->get_attr('RB-NAS-Real-Port');
> ${$_[0]}->add_attr('Calling-Station-Id', $i_p);}
>
>
> Output the following code right from PERL works fine too:
>
> perl -e 'print sprintf("%s/%s/%s.%s", map(oct("0b$_"), unpack("B32",
> pack("N", 671088873)) =~ /(.{5})(.{3})(.{8})(.*)/)) ."\n";'
> 5/0/0.233
>
>
> Any ideas? I really need to get this to work. Thanks!
--
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
===
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