Large multiple "if" optimisation

Jonathan Gazeley Jonathan.Gazeley at
Wed Nov 20 17:57:57 CET 2013

Currently I have this code block in my eduroam outer server which 
compares the MAC address of the current authentication attempt to a list 
of known MAC addresses of test clients which are then used for debugging 
without having to disrupt service by stopping the daemon and running 
radiusd -X.

if( (UOB-Stripped-MAC == "20:10:7a:1a:89:1d") || (UOB-Stripped-MAC == 
"bc:cf:cc:a1:a4:10") || (UOB-Stripped-MAC == "e4:ce:8f:49:8c:ae") || 
(UOB-Stripped-MAC == "a0:ed:cd:5c:66:70") || (UOB-Stripped-MAC == 
"94:44:52:e7:17:78") || (UOB-Stripped-MAC == "8c:3a:e3:14:eb:10") || 
(UOB-Stripped-MAC == "bc:c6:db:c7:31:30") ) {

   # Enable debug messages
   update control {
     UOB-Debug = "%{debug:9}"

It's getting a bit unwieldy to manage this block, so I'm looking for a 
better way of writing it. However it must be fast, as every eduroam user 
hits this, i.e. database lookups are unsatisfactory. Flat files might be 
ok depending on how they cached.

Any suggestions for neatening this up a bit, without compromising 


More information about the Freeradius-Users mailing list