With unlang I achive the following: Check, whether a special VLAN exists on a switch and if so, assign it. This works with the construct below. if ("%{sqlquery:SELECT value from radcheck where ( attribute='SIE-VLAN1' != '' and username='%{User-Name}') and value in (select vlan from vlan where nasname= '%{NAS-IP-Address}' ) }"!='') { update reply { Tunnel-Private-Group-ID ="%{sqlquery:SELECT value from radcheck where ( attribute='SIE-VLAN1' != '' and username='%{User-Name}') and value in (select vlan from vlan where nasname= '%{NAS-IP-Address}' )}" Tunnel-Medium-Type = IEEE-802 Tunnel-Type = VLAN } } To reduce sql queries I want to avoid the second. Can I store the result of the first query and use the value to assign Tunnel-Private-Group-ID? Thanks Norbert Wegener
Norbert Wegener wrote:
With unlang I achive the following: Check, whether a special VLAN exists on a switch and if so, assign it. ... To reduce sql queries I want to avoid the second. Can I store the result of the first query and use the value to assign Tunnel-Private-Group-ID?
Yes. Intermediate variables are possible. update control { Tmp-String-0 = "%{sqlquery:SELECT value from ... } if (control:Tmp-String-0 != "") { update reply { Tunnel-Private-Group-ID = "%{Tmp-String-0}" ... } } Alan DeKok.
participants (2)
-
Alan DeKok -
Norbert Wegener