diff --git a/files/sites-available/default b/files/sites-available/default index fc00bd7..725d847 100644 --- a/files/sites-available/default +++ b/files/sites-available/default @@ -648,13 +648,24 @@ accounting { # Ensure that &control:Pool-Name is set to determine which pool of IPs are used. # sqlippool - ### rebuild Pool-Name + # + # Determine the client type. + # Devices use a fixed IP from radreply. + # Engineers use an IP from sqlippool/radippool. + # update control { - Pool-Name := "engineers-%{sql:SELECT split_part('%{User-Name}', '@', 2)}" + Tmp-String-1 := "%{sql:SELECT client_type FROM node_assignments WHERE username='%{User-Name}'}" } - ### apply only for engineers - if (&control:Pool-Name =~ /^engineers-/) { + # + # Return the IP to the pool only for engineers. + # + if (&control:Tmp-String-1 == "engineer") { + + update control { + Pool-Name := "engineers-%{sql:SELECT split_part('%{User-Name}', '@', 2)}" + } + sqlippool } # Log traffic to an SQL database.