In my my inner-tunnel virtual server, authorize section, I have some code like this, for sorting users into vlans:

       update control {
               Tunnel-Type := "VLAN"
               Tunnel-Medium-Type := "IEEE-802"
Tunnel-Private-Group-Id := `/usr/local/etc/raddb/scripts/userVlan.pl %{User-Name} 2>/dev/null`
       }
       update reply {
               Tunnel-Type := "VLAN"
               Tunnel-Medium-Type := "IEEE-802"
Tunnel-Private-Group-Id := `/usr/local/etc/raddb/scripts/userVlan.pl %{User-Name} 2>/dev/null`
       }

This was put together in a hurry and is pretty undesirable, as the perl script (which queries a slow database) is executed twice. Of course in any other language, one would simply save the return value of the script in a variable and reference it twice - but quoting "man unlang": " Note that unlike C, there is no way to declare variables".

So is there a way to store the return value such that I can execute the script only once?

Or how about something like:

       update control {
               Tunnel-Type := "VLAN"
               Tunnel-Medium-Type := "IEEE-802"
Tunnel-Private-Group-Id := `/usr/local/etc/raddb/scripts/userVlan.pl %{User-Name} 2>/dev/null`
       }
       update reply {
               Tunnel-Type := "VLAN"
               Tunnel-Medium-Type := "IEEE-802"
Tunnel-Private-Group-Id := %{control.Tunnel-Private-Group-Id}
       }

Cheers,
Jonathan

----------------------------
Jonathan Gazeley
Systems Support Specialist
ResNet | Wireless & VPN Team
Information Services
University of Bristol
----------------------------

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to