On 16 Sep 2021, at 11:25, Antônio Modesto <modesto@hubsoft.com.br> wrote:
Hi,
Olá!
I added a column to the radpostauth table to store the NAS-Port-ID, but I am noticing a strange behaviour for a specific type of NAS. Using tcpdump, I can see that the NAS-Port-Id attributes arrives in the following format:
NAS-Port-Id Attribute (87), length: 38, Value: slot=0;subslot=2;port=1;vlanid=1110;
But when I check what is being stored in the radpostauth table and in the radacct table, I get something like this:
slot=3D3D0=3D3Bsubslot=3D3D2=3D3Bport=3D3D0=3D3Bvlanid=3D3D1001=3D3B
I am using the following expression in my queries.conf to get the value of this attribute from the request:
NULLIF('%{%{NAS-Port-ID}:-%{NAS-Port}}', '')
It seems like unlang is encoding the value somehow. Do you guys have any suggestion?
Exactly as you can see the comments along the option “safe_characters” along the raddb/mods-config/sql/main/$driver/queries.conf. basically, anything beyond that list will be _encoded_. Therefore, you could try to use the %{unescape:…} e.g: NULLIF('%{unescape:%{%{NAS-Port-ID}:-%{NAS-Port}}}', '') -- Jorge Pereira jpereira@freeradius.org