(RADIATOR) Quest ion on duplicate request

rcortez at info.com.ph rcortez at info.com.ph
Wed Sep 25 23:25:33 CDT 2002


hi hugh,

 we have another question on radius request for authentication.
base on the oracle debug logfile we are getting 2 request for
pre computation of session time.
the updatesessiontime.hook is use to recomplute the sessiontime base on 
peak / off-peak rate and update the database before radius fetch the 
value of session time. we are wondering, how come the timefunc2 
function was called twice?

first column is for date and time
second column is for the phone number
third is the total time computed 
the last digits are for stamping to identify wher the request came from

LOG FILE OF TIMEFUNC2
0926-10:58:28 028253761 v_accumulated_timestamp_a 
finaltotal|203329.260869565217391304347826086958522

0926-10:58:28 028253761 v_accumulated_timestamp_a 
finaltotal|203329.260869565217391304347826086958522


THE RADIUS DEBUG:


Thu Sep 26 10:58:28 2002 416486: DEBUG: Packet dump:
*** Received from 210.14.16.12 port 1645 ....
Code:       Access-Request
Identifier: 234
Authentic:  yD!<147><180><231>28<7><245><166>w8<209><235>L
Attributes:
        NAS-IP-Address = 210.14.16.12
        NAS-Port = 530
        NAS-Port-Type = Sync
        User-Name = "username"
        Called-Station-Id = "101300"
        Calling-Station-Id = "028253761"
        User-Password 
= "<235>fC<186><165><127><158>8<166>4<22><215><135><137>q3"
        Service-Type = Framed-User
        Framed-Protocol = PPP

Thu Sep 26 10:58:28 2002 423809: DEBUG: Handling request with 
Handler 'Called-Station-Id = "101300"'
Thu Sep 26 10:58:28 2002 426070: DEBUG: Rewrote user name to username
Thu Sep 26 10:58:28 2002 428193: DEBUG: POSTPAID Deleting session for 
username, 210.14.16.12, 530
Thu Sep 26 10:58:28 2002 429829: DEBUG: do query is: delete from 
RADONLINE where NASIDENTIFIER='210.14.16.12' and NASPORT=0530

Thu Sep 26 10:58:28 2002 480163: DEBUG: Handling with Radius::AuthSQL
Thu Sep 26 10:58:28 2002 481876: DEBUG: Handling with Radius::AuthSQL:
Thu Sep 26 10:58:28 2002 484274: DEBUG: Query is: select trim
(ENCRYPTED_PASSWORD), EXPIRATION, CLI, DEFAULTREPLY, SESSIONREPLY, SESS
IONREPLY from pps_ppaid.pps_SUBSCRIBER where CLI='028253761' and 
USERNAME = 'username'

Thu Sep 26 10:58:28 2002 495212: DEBUG: Radius::AuthSQL looks for match 
with username
Thu Sep 26 10:58:28 2002 500037: DEBUG: Radius::AuthSQL ACCEPT:
Thu Sep 26 10:58:28 2002 503344: DEBUG: Access accepted for username
Thu Sep 26 10:58:28 2002 507679: DEBUG: Packet dump:
*** Sending to 210.14.16.12 port 1645 ....
Code:       Access-Accept
Identifier: 234
Authentic:  yD!<147><180><231>28<7><245><166>w8<209><235>L
Attributes:
        Session-Timeout = 203329
        Service-Type = Framed-User
        Framed-Protocol = PPP
        Framed-IP-Netmask = 255.255.255.255
        Framed-Routing = None
        Framed-MTU = 1500
        Ascend-Maximum-Time = 203329

THE CONFIG FILE:
<Handler Called-Station-Id = "101300">
        AccountingHandled
        SessionDatabase POSTPAID
        RewriteUsername   tr/A-Z/a-z/
        AcctLogFileName %L/POSTPAID/%Y-%m-%d-detail
        PasswordLogFileName %L/POSTPAID/%Y-%m-%d-password
        
        PreAuthHook file:"%D/updatesessiontime.hook"
        
        <AuthBy SQL>
                AuthSelect select trim(ENCRYPTED_PASSWORD), EXPIRATION, 
CLI, DEFAULTREPLY, SESSIONREPLY, SESSIONREPLY from pps_ppaid
.pps_SUBSCRIBER where CLI='%{Calling-Station-Id}' and USERNAME = '%n'
                
                AuthColumnDef 0, Encrypted-Password, check
                AuthColumnDef 1, Expiration, check
                AuthColumnDef 2, Calling-Station-Id, check
                AuthColumnDef 3, GENERIC, reply
                AuthColumnDef 4, Session-Timeout, reply
                AuthColumnDef 5, Ascend-Maximum-Time, reply

                DBSource        dbi:Oracle:db
                DBUsername      dbusername
                DBAuth          dbpassword
                AccountingTable pps_ppaid.ACCOUNTING
                AccountingStopsOnly
                AcctColumnDef   USERNAME,User-Name
                AcctColumnDef   TIME_STAMP_DATE,Timestamp,formatted-
date,to_date('%e %m %Y %H:%M:%S', 'DD-MM-YYYY HH24 MI SS')
                AcctColumnDef   ACCTSESSIONID,Acct-Session-Id
                AcctColumnDef   ACCTSESSIONTIME,Acct-Session-
Time,integer
                AcctColumnDef   NASIDENTIFIER,NAS-IP-Address
                AcctColumnDef   NASPORT,NAS-Port,integer
                AcctColumnDef   CALLINGSTATIONID,Calling-Station-Id
                AcctColumnDef   CALLEDSTATIONID,Called-Station-Id
                AcctColumnDef   FRAMEDIPADDRESS,Framed-IP-Address
                AcctColumnDef   ACCTSTATUSTYPE,Acct-Status-Type
        </AuthBy>
        <AuthBy SQL>
</Handler>


THE HOOK

# $Id: updatesession.hook,v 1.1 2000/11/21 01:36:22 mikem Exp $
use DBI;

sub
{
    my $p = ${$_[0]};
    my $rp = ${$_[1]};
    my $dbh = DBI->connect( 'dbi:Oracle:dbase',
                            'dbusername',
                            'dbpassword',
                             {AutoCommit => 1}
                          ) || die "Database connection not made: 
$DBI::errstr";

    my $username = $p->getAttrByNum($Radius::Radius::USER_NAME);
    my $cli = $p->getAttrByNum($Radius::Radius::CALLING_STATION_ID);
    my $sql = qq{ UPDATE PPS_SUBSCRIBER set SESSIONREPLY=time_func2
('$cli')
                  where USERNAME = '$username' and CLI = '$cli'
                };

    $dbh->do($sql);
    $dbh->disconnect();
    return;
}



===
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