Problems with %{expr:} in 2.2.0?

Phil Mayers p.mayers at
Wed Sep 12 16:49:34 CEST 2012


We have a bit of unlang to fix up inconsistent usage of NAS-Port and 
NAS-Port-Id on our switches.

The code looks like this:

if ((NAS-Port-Id =~ /(.+):(.+)/) && (!NAS-Port)) {
         update request {
                 NAS-Port = "%{expr:1000*%{1} + %{2}}"

Since the upgrade to 2.2.0 this has been evaluating to "" i.e. the empty 
string. Unfortunately I only just noticed this.

Adding a space after the "expr:" makes it spring to life again. I'm 
guessing this might fix it:

...but I can't really see why. I'm a bit pushed for time at the moment 
so can't compile up a new copy, and will just go with the workaround.

More information about the Freeradius-Devel mailing list