Hi Alan, Thank you SO much for your response, I have managed to do exactly what I wanted once I was introduced to the un-language :) So, Thanks again.. Now I have only 1 more question, for some reason the RADIUS server is forwarding every request to the proxy twice... Could you please help me understand why? rad_recv: Accounting-Request packet from host 172.16.0.61 port 16432, id=147, length=49 Acct-Status-Type = Start Acct-Session-Id = "0" Framed-IP-Address = 94.18.167.200 Calling-Station-Id = "12345" User-Name = "Assaf" Thu May 5 09:38:00 2011 : Info: +- entering group preacct {...} Thu May 5 09:38:00 2011 : Info: ++[preprocess] returns ok Thu May 5 09:38:00 2011 : Info: ++? if ("%{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'}") Thu May 5 09:38:00 2011 : Info: sql_xlat Thu May 5 09:38:00 2011 : Info: expand: %{User-Name} -> Assaf Thu May 5 09:38:00 2011 : Info: sql_set_user escaped user --> 'Assaf' Thu May 5 09:38:00 2011 : Info: expand: SELECT * FROM dpcheck WHERE user = '%{User-Name}' -> SELECT * FROM dpcheck WHERE user = 'Assaf' Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Reserving sql socket id: 4 Thu May 5 09:38:00 2011 : Info: sql_xlat finished Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Released sql socket id: 4 Thu May 5 09:38:00 2011 : Info: expand: %{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'} -> assaf Thu May 5 09:38:00 2011 : Info: ? Evaluating ("%{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'}") -> TRUE Thu May 5 09:38:00 2011 : Info: ++? if ("%{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'}") -> TRUE Thu May 5 09:38:00 2011 : Info: ++- entering if ("%{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'}") {...} Thu May 5 09:38:00 2011 : Info: sql_xlat Thu May 5 09:38:00 2011 : Info: expand: %{User-Name} -> Assaf Thu May 5 09:38:00 2011 : Info: sql_set_user escaped user --> 'Assaf' Thu May 5 09:38:00 2011 : Info: expand: SELECT Class FROM dpcheck WHERE User ='%{User-Name}'; -> SELECT Class FROM dpcheck WHERE User ='Assaf'; Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Reserving sql socket id: 3 Thu May 5 09:38:00 2011 : Info: sql_xlat finished Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Released sql socket id: 3 Thu May 5 09:38:00 2011 : Info: expand: %{sql: SELECT Class FROM dpcheck WHERE User ='%{User-Name}';} -> profile Thu May 5 09:38:00 2011 : Info: +++[request] returns ok Thu May 5 09:38:00 2011 : Info: +++[control] returns ok Thu May 5 09:38:00 2011 : Info: ++- if ("%{sql:SELECT * FROM dpcheck WHERE user = '%{User-Name}'}") returns ok Thu May 5 09:38:00 2011 : Info: +- entering group accounting {...} Thu May 5 09:38:00 2011 : Info: [sql] expand: %{User-Name} -> Assaf Thu May 5 09:38:00 2011 : Info: [sql] sql_set_user escaped user --> 'Assaf' Thu May 5 09:38:00 2011 : Info: [sql] expand: %{Acct-Delay-Time} -> Thu May 5 09:38:00 2011 : Info: [sql] ... expanding second conditional Thu May 5 09:38:00 2011 : Info: [sql] expand: INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, acctstartdelay, acctstopdelay, xascendsessionsvrkey) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', NULL, '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Reserving sql socket id: 2 Thu May 5 09:38:00 2011 : Debug: rlm_sql (sql): Released sql socket id: 2 Thu May 5 09:38:00 2011 : Info: ++[sql] returns ok Thu May 5 09:38:00 2011 : Info: [detail] expand: /var/log/freeradius/radacct/%{Client-IP-Address}/detail-%Y%m%d -> /var/log/freeradius/radacct/172.16.0.61/detail-20110505 Thu May 5 09:38:00 2011 : Info: [detail] /var/log/freeradius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands to /var/log/freeradius/radacct/172.16.0.61/detail-20110505 Thu May 5 09:38:00 2011 : Info: [detail] expand: %t -> Thu May 5 09:38:00 2011 Thu May 5 09:38:00 2011 : Info: ++[detail] returns ok Thu May 5 09:38:00 2011 : Info: WARNING: Empty section. Using default return values. Sending Accounting-Request of id 251 to 10.100.1.148 port 1813 Acct-Status-Type = Start Acct-Session-Id = "0" Framed-IP-Address = 94.18.167.200 Calling-Station-Id = "12345" User-Name = "Assaf" NAS-IP-Address = 172.16.0.61 Class = 0x70726f66696c65 Proxy-State = 0x313437 Thu May 5 09:38:00 2011 : Info: Proxying request 2 to home server 10.100.1.148 port 1813 Sending Accounting-Request of id 251 to 10.100.1.148 port 1813 Acct-Status-Type = Start Acct-Session-Id = "0" Framed-IP-Address = 94.18.167.200 Calling-Station-Id = "12345" User-Name = "Assaf" NAS-IP-Address = 172.16.0.61 Class = 0x70726f66696c65 Proxy-State = 0x313437 Thu May 5 09:38:00 2011 : Debug: Going to the next request Thu May 5 09:38:00 2011 : Debug: Waking up in 0.9 seconds. rad_recv: Accounting-Response packet from host 10.100.1.148 port 1813, id=251, length=20 Thu May 5 09:38:00 2011 : Info: +- entering group post-proxy {...} Thu May 5 09:38:00 2011 : Info: [eap] No pre-existing handler found Thu May 5 09:38:00 2011 : Info: ++[eap] returns noop Sending Accounting-Response of id 147 to 172.16.0.61 port 16432 Thu May 5 09:38:00 2011 : Info: Finished request 2. Thu May 5 09:38:00 2011 : Info: Cleaning up request 2 ID 147 with timestamp +201 Thu May 5 09:38:00 2011 : Debug: Going to the next request Thu May 5 09:38:00 2011 : Info: Ready to process requests. Thanks alot! Eitam. -- View this message in context: http://freeradius.1045715.n5.nabble.com/Condition-Based-Accounting-Proxy-tp4... Sent from the FreeRadius - Dev mailing list archive at Nabble.com.