Trouble with missing CiscoNASPort

Kai Arne Bjørnenak kai.bjornenak at cc.uit.no
Wed May 21 10:25:55 CEST 2008


Hello

We run Freeradius 1.1.7 against a postgresql-database, and for some 
auth-sessions Cisco NAS Port does not get stored in the database. I have 
checked the freeradius detail-logs to see that the server really has 
these values, so I'm a bit stumped as to why this happens. The 
SQL-queries have been slightly modified to fit our use, so I'm including 
the relevant ones here from postgresql.conf.

    accounting_update_query = "UPDATE ${acct_table1} \
                SET FramedIPAddress = NULLIF('%{Framed-IP-Address}', 
'')::inet, \
                AcctSessionTime = (EXTRACT(EPOCH FROM(now()::timestamp 
with time zone - AcctStartTime::timestamp with time zone - 
'%{Acct-Delay-Time:-0}'::interval)))::BIGINT, \
                AcctInputOctets = (('%{Acct-Input-Gigawords:-0}'::bigint 
<< 32) + '%{Acct-Input-Octets:-0}'::bigint), \
                AcctOutputOctets = 
(('%{Acct-Output-Gigawords:-0}'::bigint << 32) + 
'%{Acct-Output-Octets:-0}'::bigint) \
                WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}' AND 
UserName = '%{SQL-User-Name}' \
                AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStopTime 
IS NULL"

      accounting_update_query_alt = "INSERT into ${acct_table1} \
                (AcctSessionId, AcctUniqueId, UserName, Realm, 
NASIPAddress, NASPortType, CiscoNASPort, AcctStartTime, \
                AcctSessionTime, AcctInputOctets, AcctOutputOctets, 
CalledStationId, CallingStationId, \
                FramedProtocol, FramedIPAddress) \
                values('%{Acct-Session-Id}', 
'%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', 
'%{NAS-IP-Address}', \
                '%{NAS-Port-Type}', NULLIF('%{Cisco-NAS-Port}', ''), 
(now() -  '%{Acct-Delay-Time:-0}'::interval - 
'%{Acct-Session-Time:-0}'::interval), \
                NULLIF('%{Acct-Session-Time}','')::bigint, \
                (('%{Acct-Input-Gigawords:-0}'::bigint << 32) + 
'%{Acct-Input-Octets:-0}'::bigint), \
                (('%{Acct-Output-Gigawords:-0}'::bigint << 32) + 
'%{Acct-Output-Octets:-0}'::bigint), '%{Called-Station-Id}', \
                '%{Calling-Station-Id}', '%{Framed-Protocol}', \
                NULLIF('%{Framed-IP-Address}', '')::inet)"

      accounting_start_query = "INSERT into ${acct_table1} \
                (AcctSessionId, AcctUniqueId, UserName, Realm, 
NASIPAddress, NASPortType, CiscoNASPort, AcctStartTime, \
                CalledStationId, CallingStationId, FramedProtocol, 
FramedIPAddress, AcctStartDelay) \
                values('%{Acct-Session-Id}', 
'%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', 
'%{NAS-IP-Address}', \
                '%{NAS-Port-Type}', NULLIF('%{Cisco-NAS-Port}', ''), 
(now() - '%{Acct-Delay-Time:-0}'::interval), \
                '%{Called-Station-Id}', '%{Calling-Station-Id}', 
'%{Framed-Protocol}', \
                NULLIF('%{Framed-IP-Address}', '')::inet, 
'%{Acct-Delay-Time:-0}') "

      accounting_start_query_alt  = "UPDATE ${acct_table1} \
                SET AcctStartTime = (now() - 
'%{Acct-Delay-Time:-0}'::interval), \
                WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}' AND 
UserName = '%{SQL-User-Name}' \
                AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime 
IS NULL"


If I could get any pointers as to what could be wrong or ways to debug 
this I would be very grateful.


Regards

Kai Bjørnenak







More information about the Freeradius-Users mailing list