New feature in v3: cast!

Alan DeKok aland at deployingradius.com
Sat May 11 16:19:02 CEST 2013


  Not fishing casts, but data type casts. :)  See "man unlang" for details.

  if (<ipaddr>127.0.0.1 < &Framed-IP-Address) {
	...
  }

  It allows you to do type-specific comparisons.  v2 usually did string
comparisons for conditions.  To get type-specific comparisons, you
sometimes needed to put the data into an intermediate variable.

  That was ugly.  The casting is nicer.

  That being said, the above example *did* work in v2, with some changes:

  if (Framed-IP-Address > 127.0.0.1) {
	...
  }

  That worked by parsing the RHS into a temporary variable, and then
doing type-specific comparisons.  But you couldn't do:

  if (<date>"January 1 2014" < "%{sql: SELECT ...}") {
	...
  }

  You had to put one or the other of the strings into an intermediate
variable.

  This is another minor feature which just makes things nicer.

  Alan DeKok.


More information about the Freeradius-Devel mailing list