New feature in v3: cast!

Alan DeKok aland at deployingradius.com
Tue May 14 15:27:43 CEST 2013


Brian Candler wrote:
> and this works. But I get a syntax error if I change the first line to
> 
>         if (reply:Framed-IP-Address =* 0.0.0.0) {
> 
> Expected comparison at: =*
> /Users/brian/Build/freeradius/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.

  Yeah.  That's forbidden in 2.x.

> After a bit of thought, I found I could rewrite it more simply as
> 
>         if (reply:Framed-IP-Address) {

  Which is also documented.  See "man unlang".

> Still, this appears to be a minor inconsistency between unlang and checkitem
> operators.

  Yes.  The checkitem stuff *requires* all 3 fields.  So simple checks
for existence aren't allowed.  In v3, the =* operator is allowed.  It is
re-written internally to be just an existence check.

  There are a number of other "peep-hole" optimizations done by the new
code.  See src/tests/condition.txt.  e.g.

  (((((foo))))) --> foo
  !(!foo)       --> foo

  etc.

  That allows the run-time interpretor to do less work.  It also ensures
that the run-time interpretor has *one* version of "unlang" it
interprets.  And not many equal (but different) variations.

  Alan DeKok.


More information about the Freeradius-Devel mailing list