[RADIATOR] PreClientHook not behaving as expected

Bruno Tiago Rodrigues bruno.tiago.rodrigues at gmail.com
Mon Feb 27 12:45:41 CST 2012


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;
}


More information about the radiator mailing list