[RADIATOR] PreClientHook not behaving as expected

Michael ringo at vianet.ca
Mon Feb 27 13:22:31 CST 2012


The PreClientHook is a hook that is run before the packet is unpacked.

<snip>
Caution: At the time this hook is run, integer attributes have not yet been unpacked and
decoded, and encrypted attributes have not yet been decrypted. If you need unpacked,
decrypted versions of these attributes, consider using a per-client ClientHook instead.
<snip>


On 12-02-27 01:45 PM, Bruno Tiago Rodrigues wrote:
> This looks like a basic question, but I haven't been able to sort it out.
>
> Basically I have a structure of Radiator AuthBy and Handlers set for
> Accounting and needed to filter out some "special" packets being sent
> to the server.
>
> I've done this with a specific hook, pointed it to a ClientHook clause
> and had it running as expected. Then I moved it to a PreClientHook
> clause and it didn't work properly.
>
> This is happening when I peek at the Acct-Status-Type for the request
> packet, I managed to narrow it down to a specific bit of code, but I
> found out by dumping the packet structure that there are other fields
> showing up garbled.
>
> When called from a PreClientHook, Data::Dumper on the request packet
> shows a bunch of entries like this
>                   'Attributes' =>  [
>                                     [
>                                       'Acct-Status-Type',
>                                       '^@^@^@^C'
>                                     ],
>                                     [
>                                       'NAS-IP-Address',
>                                       'S<AE>3<FD>'
>                                     ],
>                                     [
>                                       'User-Name',
>                                       '00:14:7f:eb:36:4b'
>                                     ],
>                                     [
>                                       'Framed-IP-Address',
>                                       'S<AE>5<EA>'
>                                     ],
>                                     [
>                                       'Framed-IP-Netmask',
>                                       '<FF><FF><FF><80>'
>                                     ],
>                                     [
>                                       'NAS-Identifier',
>                                       'test01nas'
>                                     ],
>                                     [
>                                       'Acct-Session-Id',
>
> '23 at 2/1/1:2999 at 10.0.0.234@00:14:7f:eb:36:4b at 0_2012/02/27 17:05:23'
>                                     ],
>                                     [
>                                       'Acct-Session-Time',
>                                       '^@^@^U<89>'
>                                     ],
>
>
> There are some entries that show up as expected (ie, not garbled).
> When called from a ClientHook, the Data::Dumper show the expected
> (plaintext ASCII) value for all fields of the same packet.
>
> Is this normal?
>
> The code is fairly simple, I narrowed it down to something like
>
> sub {
>      my $r = ${$_[0]};
>      return unless $r->code() eq 'Accounting-Request';
>
>      my $acct_type=$r->get_attr('Acct-Status-Type');
>
>      &main::log($main::LOG_INFO,"Caught Accounting $acct_type packet");
>      return;
> }
> _______________________________________________
> radiator mailing list
> radiator at open.com.au
> http://www.open.com.au/mailman/listinfo/radiator
>
>


More information about the radiator mailing list