[RADIATOR] preClientHook problem using ClientListSQL from version 3.15 to version 4.3.1

Dario Aguilar daguilar at arnet.net.ar
Wed Jan 7 11:49:48 CST 2009


Hi, first of all I want to clarify that I am a new user of Radiator and my
knowledge of Perl language is very poor. We are trying to move from version
3.15 to 4.3.1 and some problems a problem appered to us with the old Global
"preClientHook" statement in the new version. How should I call
PreClientHook.cfg to work in using ClientListSQL ?. I´ve already finish
reading the revision history of versions 4.3 and 4.3.1 and the reference
manual but I still have very clear how to implement this in our server.

Our radius.conf looks something like this:
-------------------------------------------------------------
<ClientListSQL>
        DBSource                dbi:Oracle:%{GlobalVar:DBInstance}
        DBUsername              %{GlobalVar:DBUsername}
        DBAuth                  %{GlobalVar:DBAuth}
        DBSource                dbi:Oracle:%{GlobalVar:DBInstance}
        DBUsername              %{GlobalVar:DBUsername}
        DBAuth                  %{GlobalVar:DBAuth}
        GetClientQuery          SELECT nas_ip_address,secret from
tbl_radclient WHERE nas_ip_address IS NOT NULL and secret IS NOT NULL
        BackupFilename         
%D/clientlist.%{GlobalVar:CodeType}.%{GlobalVar:IpAddress}.dat
        RefreshPeriod           3600
        Timeout                 2
        FailureBackoffTime      0
        ConnectionHook file:"%D/ConnectionHook.cfg"
</ClientListSQL>

PreClientHook file:"%D/PreClientHook.cfg"
-------------------------------------------------

PreClientHook.cfg----->>>

sub {
        my $p=${$_[0]};
        my $nasip=$p->get_attr('NAS-IP-Address');
        my $ip=&Radius::Util::format_special('%c', $p);
        my $nasport=$p->get_attr('NAS-Port');
        my $callid=$p->get_attr('Calling-Station-Id');

        &main::log($main::LOG_DEBUG,'Into PreClientHook');
        &main::log($main::LOG_DEBUG,"NASIP=[$nasip] NASPORT=[$nasport]
SOURCE_IP=[$ip] CallId=[$callid]");
         if($ip ne '192.168.0.1' and $ip ne '192.168.0.2') {
                $p->change_attr('NAS-IP-Address',$ip) if $nasip ne $ip;
        }

        $p->add_attr('NAS-Port',$callid) unless defined $nasport;
        $p->delete_attr('State');
        if ($p->code eq 'Accounting-Request' &&
$p->get_attr('Acct-Status-Type') eq 'Stop') {
                my %ascend2ietf = (
                        'remoteEndHungup'       => 'User-Request',
                        'pppRcvTerminate'       => 'User-Request',
                        'sessTimeOut'           => 'Session-Timeout',
                        '240'                   => 'Host-Request',
                );

                my $ascend_disconnect_cause =
$p->get_attr('Ascend-Disconnect-Cause');
                if($ascend_disconnect_cause) {
                        my $newval=$ascend2ietf{$ascend_disconnect_cause};
                        $newval='Lost-Carrier'
                                unless defined $newval;
                        $p->change_attr('Acct-Terminate-Cause', $newval);
                }
        }
}
-------------------------------------------

thanks, 
Dario Aguilar
-- 
View this message in context: http://www.nabble.com/preClientHook-problem-using-ClientListSQL-from-version-3.15-to-version-4.3.1-tp21336689p21336689.html
Sent from the Radiator - General mailing list archive at Nabble.com.




More information about the radiator mailing list