Regular expresion problem
BALSIANOK, Peter
Peter.Balsianok at orange.sk
Fri Dec 28 15:14:38 CET 2012
Thx Alan,
I have modified site-enabled/default section preacct. Is it possible to stop processing after first match ( somethink like Fall-Through = No in users file ) ?
if (Called-Station-Id =~ /orangewap/i) {
update control {
Proxy-To-Realm := realm_orangewap
}
update request {
Called-Station-Id := "%{Called-Station-Id}.%{3GPP-SGSN-Address}"
}
}
elsif (Called-Station-Id =~ /mvaswap/i) {
update control {
Proxy-To-Realm := realm_mvaswap
}
update request {
Called-Station-Id := "%{Called-Station-Id}.%{3GPP-SGSN-Address}"
}
}
elsif (Called-Station-Id =~ /orangewap-ng/i) {
update control {
Proxy-To-Realm := realm_orangewap_ng
}
update request {
Called-Station-Id := "%{Called-Station-Id}.%{3GPP-SGSN-Address}"
}
}
elsif (Called-Station-Id =~ /mvaswapsite/i) {
update control {
Proxy-To-Realm := realm_mvaswapsite
}
update request {
Called-Station-Id := "%{Called-Station-Id}.%{X-Ascend-Route-IP}"
}
}
Debug output:
(0) ? if (Called-Station-Id =~ /orangewap/i)
(0) ? Evaluating (Called-Station-Id =~ /orangewap/i) -> TRUE
(0) ? if (Called-Station-Id =~ /orangewap/i) -> TRUE
(0) if (Called-Station-Id =~ /orangewap/i) {
(0) - entering if (Called-Station-Id =~ /orangewap/i) {...}
(0) update control {
(0) } # update control = ok
(0) update request {
(0) expand: %{Called-Station-Id}.%{3GPP-SGSN-Address} -> ORANGEWAP.213.151.252.35
(0) } # update request = ok
(0) - if (Called-Station-Id =~ /orangewap/i) returns ok
(0) ... skipping elsif for request 0: Preceding "if" was taken
(0) ... skipping elsif for request 0: Preceding "if" was taken
(0) ... skipping elsif for request 0: Preceding "if" was taken
-----Original Message-----
From: freeradius-users-bounces+peter.balsianok=orange.sk at lists.freeradius.org [mailto:freeradius-users-bounces+peter.balsianok=orange.sk at lists.freeradius.org] On Behalf Of Alan DeKok
Sent: Friday, December 28, 2012 2:29 PM
To: FreeRadius users mailing list
Subject: Re: Regular expresion problem
BALSIANOK, Peter wrote:
> I want to use regular expression in acct_users file
>
> DEFAULT Called-Station-Id =~ /orangewap/i,
That doesn't work.
For the /.../i syntax to work, you MUST use "unlang":
...
if (Called-Station-Id =~ /orangewap/i) {
update control {
Proxy-To-Realm := realm_orangewap
}
update reply {
Called-Station-Id = "%{Called-Station-Id}.%{3GPP-SGSN-Address}"
}
}
Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
More information about the Freeradius-Users
mailing list