From 728b99e13854af69d6cbb0db2c3676e0e542ecf4 Mon Sep 17 00:00:00 2001 From: "noussair.hamrit" Date: Wed, 16 Sep 2026 17:04:06 +0200 Subject: [PATCH] fix(radius): prevent devices from using sqlippool during accounting --- files/sites-available/default | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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.