On Thu, 10 Oct 2002, Sergey Holod wrote: > On Monday 07 October 2002 21:42, Aleksandar Zhelyazkov wrote: > > There are also some diferences between the sql db schema supplied in > > src/modules/rlm_sql/drivers/rlm_sql_postgres/db_postgres.sql > > and the sql statemetns for accounting_onoff etc in postgresql.conf > > Some time ago I've posted here patch for "right" config and schema > don't know maybe , it is in CVS.. > Yep, we got few mistakes there :) Seems like nobody didn't try to use it before :-) Anyway, thanx. And shame on me (i knew about that and did nothing :) )
Replace Nas-Port field name with Nas-Port-id and leave %{NAS-Port} unchanged, and of course write somthing else except "...AND AcctStopTime = 0" in accounting_update_query. Maybe "... AcctSessionTime = 0". It's not a good idea, cause u can get zero sessions, as well as comparing AcctStartTime,AcctStopTime timestamps, so i do acct_start that way: accounting_start_query = "INSERT into radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', '-1', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0')" -1 in AcctSessionTime field indicates opened users session. My accounting_update_query looks like: accounting_update_query = "UPDATE ${acct_table1} SET FramedIPAddress = '%{Framed-IP-Address}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{User-Name}' AND NASIPAddress= '%{NAS-IP-Address}' and NASPortId='%{NAS-Port}' " It doesn't really matter... Even if it updates several rows... maybe better would be "... and AcctSessionTime=-1" My config was more complicated, i just tried to rip my functions/where clauses/etc and "generalize" it that day and posted it... nobody complained :) My current config is optimized for use with buggy NAS-es and proxy, which often sends Start, Stop packets several times with totally different information, so i'm forced to filter it :( Accounting on/off i've tested on cisco 3620 NAS and fr 0.4. I did not see any mistakes. Feel free to point me on my mistakes. P.S. me is ME :-) -- cron-ripe - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html