1 CREATE OR REPLACE FUNCTION msqlippool(user varchar2, pool varchar2)
4 PRAGMA AUTONOMOUS_TRANSACTION;
8 -- If the user's pool is dynamic, get an ipaddress (oldest one) from the corresponding pool
10 if pool = 'Dynamic' then
11 select framedipaddress into ip_temp from (select framedipaddress from radippool where expiry_time < current_timestamp and pool_name = pool ORDER BY expiry_time) where rownum = 1;
14 -- Else, then get the static ipaddress for that user from the corresponding pool
17 select framedipaddress into ip_temp from radippool where username = user and pool_name = pool;
23 -- This block is executed if there's no free ipaddresses or no static ip assigned to the user
25 when NO_DATA_FOUND then
26 if pool = 'Dynamic' then
27 return(''); -- so sqlippool can log it on radius.log
30 -- Else, grabs a free IP from the static pool and saves it in radippool so the user will always get the same IP the next time
32 select framedipaddress into ip_temp from (select framedipaddress from radippool where expiry_time < current_timestamp and username is null and pool_name = pool) where rownum = 1;
33 UPDATE radippool SET username = user where framedipaddress = ip_temp;
38 then return('Oracle Exception');