Problems with %{expr:} in 2.2.0?

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


All,

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:

https://github.com/alandekok/freeradius-server/commit/a01dd0fd6d0aaf65d52057a17bf2c9038444b7ac

...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