Problem when trying to store NAS-Port-ID into radpostauth table
Antônio Modesto
modesto at hubsoft.com.br
Thu Sep 16 18:50:17 CEST 2021
On 16/09/2021 12:23, Jorge Pereira wrote:
>
>
>> On 16 Sep 2021, at 11:25, Antônio Modesto <modesto at 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}}}', '')
Hello,
Thanks for your suggestion, but unfortunatelly it didn't work. I noticed
the escaping happens in the rlm_sql module, so passing the unescaped
string to it has no effect. I think the only solution would be to modify
safe_characters to include the characters I am having problem with.
Any better idea?
>
> --
> Jorge Pereira
> jpereira at freeradius.org
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
--
Att, *Antônio Modesto*
More information about the Freeradius-Users
mailing list