Hex to Cleartext

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Dec 5 15:36:45 CET 2018



> On Dec 4, 2018, at 11:50 PM, Chinnapaiyan, Nagamani <Nagamani.Chinnapaiyan at viasat.com> wrote:
> 
> This “0x%{redis:…}” doesnot work for me.
> 
> Lines in config file:
>        if(updated && "0x%{redis: GET %{control:Pool-Name}:option}") {
>                update reply {
>                        &DHCP-Vendor = "0x%{redis: GET %{control:Pool-Name}:option}"
>                }
>        }
> It parses the if condition correctly.. but  the assignment part somehow it doesnot process it correctly.

You want:

update reply {
	&DHCP-Vendor = "%{bin:%{redis: GET %{control:Pool-Name}:option}}"
}

Bin takes a hex string and returns a buffer containing the binary data.  Bin doesn't require a 0x prefix, but will automatically strip one if it finds one.

It's a bit annoying needing to jump through these hoops though.  I'm guessing you're inserting the hexits into redis instead of the binary string?  The xlat is binary safe so you shouldn't need to do that...

-Arran


More information about the Freeradius-Users mailing list