Unlang and variables

Alan DeKok aland at deployingradius.com
Thu Sep 28 23:57:33 CEST 2017

On Sep 28, 2017, at 3:50 PM, Ti Ti <tt91em at gmail.com> wrote:
> Hello,
> I'm using unlang to discriminate the database to use as described in the
> code below.
> Is there a method to use variables so avoid the redundant check of NAS-Id?

  You can't mix multiple regular expressions and get multiple different outputs.  The regular expression libraries don't allow it.

  If you want to use the same set of "if" statements in multiple places, use policies.  Add raddb/policy.d/check-nas-id, and put this into it:

policy check-nas-id {
     if (&NAS-Identifier =~ /test/i) {
     if (&NAS-Identifier =~ /test2/i) {

  Then everywhere you need that set of "if" statements, just use:


  Alan DeKok.

More information about the Freeradius-Users mailing list