I solved it!
Thanks to Arran Cudbard-Bell for the clue!
First, created a table called "userhardaddr" with username and mac(PK) both varchar.
In (radius conf dir)/sites-enabled/defaul (section post-auth) I made a "REPLACE" query:
post-auth {
...
update reply {
Tmp-String-0 := "%{sql:REPALCE INTO userhardaddr(username,mac) VALUES(%{User-Name},%{Calling-Station-Id})}"
...
}
}
This replace the user for a connected MAC in the table if exist. If not exist, REPLACE creates the row as in INSERT.
Then, in sites-enabled/dhcp (discover and request sections):
dhcp DHPC-Discover {
update request {
...
User-Name = "%{sql:SELECT username FROM userhardaddr where mac = REPLACE ('%{DHCP-Client-Hardware-Address}',':','-')}"
...
}
...
if(&User-Name=='guest') {
&Pool-Name = "guest_pool"
}
else {
&Pool-Name = "main_pool"
}
...
}
...
dhcp DHPC-Request {
(same in discover)
}
With this I get the user name from the DB according to the mac address.
In the IF statement I compare the value returned by the query to "guest" and assign the corresponding IP pool.
Thanks again.
Regards.