xlat: something like eval()? problems with avp into in another avp
Alan DeKok
aland at deployingradius.com
Wed Sep 16 16:15:27 CEST 2015
On Sep 16, 2015, at 9:53 AM, Jorge Pereira <jpereiran at gmail.com> wrote:
> I would like to know how "expand" an avp into in another avp. below my
> example.
>
> Wed Sep 16 13:37:43 2015 : Debug: (0) policy my.captive_redirect {
> Wed Sep 16 13:37:43 2015 : Debug: (0) update {
> Wed Sep 16 13:37:43 2015 : Debug: (0) EXPAND %{My-Portal-Url}
> Wed Sep 16 13:37:43 2015 : Debug: (0) -->
> http://meu-host.intra.net/integration-bus/v1/redir/start?acctSessionId=%{Acct-Session-Id}
> Wed Sep 16 13:37:43 2015 : Debug: (0) &reply:Alc-Wlan-Portal-Url
> :=
> http://meu-host.intra.net/integration-bus/v1/redir/start?acctSessionId=%{Acct-Session-Id}
> Wed Sep 16 13:37:43 2015 : Debug: (0) } # update = noop
> Wed Sep 16 13:37:43 2015 : Debug: (0) } # policy
> alcatel.captive_redirect = noop
You can't do 2 layers of expansion.
update request {
Foo := "%{bar}"
}
will work.
But if "bar" is itself an expansion, that won't wok. The "Foo" attribute will just get the string value of "bar", not the expanded version.
The redis example is different. The RHS of the redis expansion %{redis: ... RHS ... } is itself expanded before being passed to redis. So a "double expansion" works there.
Having the server *automatically* do double expansion of attributes would be terrible. Where would you stop?
We'd be better off having an explicit "double expansion" thing:
baz = "hello"
bar := '%{baz}' # note single quotes...
update request {
Foo := "%{expand:%{Bar}}"
}
Which should work.
Alan DeKok.
More information about the Freeradius-Users
mailing list