Unlang issue

Garber, Neal Neal.Garber at iberdrolausa.com
Thu Jul 28 17:12:00 CEST 2011


I'm running FR 2.1.6 (I know - I plan to upgrade later this year).  Is there anything wrong syntactically with the following code or is this a bug that was fixed since 2.1.6?

if (Client-IP-Address == "172.20.16.28" || Client-IP-Address == "172.20.204.10")) {
    update request {
        Huntgroup-Name := "GlobalRoaming"
    }
}

#
# If NAS is an autonomous AP, get SSID from Cisco-AVPair
#
if (Huntgroup-Name == "EEProdAP" || \
    Huntgroup-Name == "EETestAP") {
    if (Cisco-AVPair =~ /ssid=(.*)/) {
        update request {
            SSID-Name = "%{1}"
        }
    }
}

I ask because the first if statement only works if the Client-IP-Address matches the first address listed (172.20.16.28).  I would expect that it would evaluate to true if Client-IP-Address matches either of the addresses.  Here's a snippet of debug output that illustrates the problem - it doesn't appear to finish the logical or comparison:

Info: ++? if (Called-Station-Id && (Client-IP-Address == "172.20.16.28" ||                                   Client-IP-Address == "172.20.204.10"))
Info: ? Evaluating (Called-Station-Id ) -> TRUE
Info:        expand: %{Client-IP-Address} -> 172.20.204.10
Info: ++? if (Huntgroup-Name == "EEProdAP" || Huntgroup-Name == "EETestAP")
Info:     (Attribute Huntgroup-Name was not found)

When I switch the order of the addresses for the logical or, I see the following in debug (it does the comparison and returns TRUE):

Info: ++? if (Called-Station-Id && (Client-IP-Address == "172.20.204.10" ||                                   Client-IP-Address == "172.20.16.28"))
Info: ? Evaluating (Called-Station-Id ) -> TRUE
Info:        expand: %{Client-IP-Address} -> 172.20.204.10
Info: ?? Evaluating (Client-IP-Address == "172.20.204.10" ) -> TRUE
Info: ?? Skipping (Client-IP-Address == "172.20.16.28")
Info: ++? if (Called-Station-Id && (Client-IP-Address == "172.20.204.10" ||                                   Client-IP-Address == "172.20.16.28")) -> TRUE
Info: ++- entering if (Called-Station-Id && (Client-IP-Address == "172.20.204.10" ||                                   Client-IP-Address == "172.20.16.28")) {...}
Info: +++[request] returns ok
Info: ++- if (Called-Station-Id && (Client-IP-Address == "172.20.204.10" ||                                   Client-IP-Address == "172.20.16.28")) returns ok
Info: ++? if (Huntgroup-Name == "EEProdAP" || Huntgroup-Name == "EETestAP")
Info: ? Evaluating (Huntgroup-Name == "EEProdAP" ) -> FALSE
Info: ? Evaluating (Huntgroup-Name == "EETestAP") -> FALSE
Info: ++? if (Huntgroup-Name == "EEProdAP" || Huntgroup-Name == "EETestAP") -> FALSE


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20110728/3a862fbc/attachment.html>


More information about the Freeradius-Users mailing list