Hi, We use freeradius 2.0.5, currently for testing. I've encountered a weird problem with if expansion:
config: server local_logger { listen { type = detail filename = ${radacctdir}/detail_local load_factor = 20 } listen { type = acct ipaddr = * port = 1822 secret = xxxxxx } accounting { if ("%{Acct-Session-Time}" == 0 && "%{Acct-Delay-Time}" == 0 && "%{Acct-Status-Type}" == "Stop"){ ok } else{ sql_localhost } } } debug: detail_recv: Read packet from /var/log/freeradius/radacct/detail_local User-Name = "roatt" NAS-Port = 117440512 NAS-IP-Address = 10.119.255.91 Framed-IP-Address = xx.yy..135.238 Filter-Id = "normal" NAS-Identifier = "akl-grafton-bras2" Acct-Status-Type = Interim-Update Acct-Delay-Time = 23 Acct-Input-Octets = 2253089 Acct-Output-Octets = 26743952 Acct-Session-Id = "akl-gra07000000000000e3b284039482" Acct-Authentic = RADIUS Acct-Session-Time = 27000 Acct-Input-Packets = 20268 Acct-Output-Packets = 27407 Acct-Input-Gigawords = 0 Acct-Output-Gigawords = 0 Event-Timestamp = "Jul 2 2008 10:26:27 NZST" NAS-Port-Type = Virtual Calling-Station-Id = "GigabitEthernet 10/0.90810:9-810#587203901#INFA290611:RIC-RAN-21 to RIC-ETH51 port 2/1/1##pppoe 00:90:d0:6a:aa:eb#" NAS-Port-Id = "slot=7;subslot=0;port=0;vlanid=0;" Tunnel-Type:0 = L2TP Tunnel-Medium-Type:0 = IPv4 Tunnel-Server-Endpoint:0 = "10.176.0.230" Tunnel-Client-Endpoint:0 = "222.152.43.30" Service-Type = Framed-User Framed-Protocol = PPP Huawei-IPHost-Addr = "xx.yy.135.238 ff:ff:ff:ff:ff:ff" Huawei-Input-Peak-Rate = 0 Huawei-Input-Average-Rate = 0 Huawei-Output-Peak-Rate = 0 Huawei-Output-Average-Rate = 0 Huawei-Priority = 0 Huawei-Connect-ID = 39482 Huawei-Domain-Name = "ihug-ubs" Huawei-Qos-Profile-Name = "default" Proxy-State = 0x313134 Huntgroup-Name = "ADSL" Acct-Unique-Session-Id = "c5f44e1423b4012a" server local_logger { +- entering group accounting ++? if ("%{Acct-Session-Time}" == 0 && "%{Acct-Delay-Time}" == 0 && "%{Acct-Status-Type}" == "Stop") expand: %{Acct-Session-Time} -> 27000 ? Evaluating ("%{Acct-Session-Time}" == 0 ) -> FALSE Skipping ("%{Acct-Delay-Time}" == 0 ) ++? if ("%{Acct-Session-Time}" == 0 && "%{Acct-Delay-Time}" == 0 && "%{Acct-Status-Type}" == "Stop") -> TRUE ++- entering if ("%{Acct-Session-Time}" == 0 && "%{Acct-Delay-Time}" == 0 && "%{Acct-Status-Type}" == "Stop") +++[ok] returns ok ++- if ("%{Acct-Session-Time}" == 0 && "%{Acct-Delay-Time}" == 0 && "%{Acct-Status-Type}" == "Stop") returns ok ++ ... skipping else for request 1: Preceding "if" was taken } # server local_logger As you can see the first condition evaluates to FALSE (which is expected, but then the whole expression turns TRUE, which is somewhat unexpected. The reason for having that condition is to filter out packets that have 0 session time that cause issues with rlm_sql. If I re-write to condition like this: accounting { if ("%{Acct-Session-Time}" == 0){ if ("%{Acct-Delay-Time}" == 0){ if ("%{Acct-Status-Type}" == "Stop"){ ok } else{ sql_localhost } } else{ sql_localhost } } else{ sql_localhost } } it works as expected, just looks ugly :-( kind regards Pshem - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html