HEX Stripping using attr_rewrite

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Jun 4 10:32:22 CEST 2014

On 4 Jun 2014, at 02:25, Peter Lambrechtsen <peter at crypt.co.nz> wrote:

> As per the email I sent to you off-list, this should fix it:
>         if ( ADSL-Agent-Remote-Id =~ /\\001(.*)/ ){
>                 update request {
>                         ADSL-Agent-Remote-Id := "%{1}"
>                 }
>         }

Um. Maybe... I guess you've tested that?

> On Wed, Jun 4, 2014 at 12:02 PM, Simon Allard <Simon.Allard at team.orcon.net.nz> wrote:
> Hi Freeradius list :-)
> I am have a bit of an issue with the stripping hex values from my ADSL-Agent-Remote-ID field in my Auth packet.
> I am using an Alcatel-Lucent 7750SR platform

My condolences.

> and for some reason they decided when converting a DHCPv6 packet into a radius packet it appends the Enterprise ID (which is a hex number) into the ADSL-Agent-Remote-ID.


A way that doesn't rely on FR being \0 safe is to do something like:

if ("%{hex:ADSL-Agent-Remote-Id}" =~ /^....([0-9a-f]+)$/) {
	update request {
		Tmp-Octets-0 := "0x%{1}"
	update request {
		ADSL-Agent-Remote-ID := "%{string:Tmp-Octets-0}"

But that's pretty nasty.


Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140604/0bf22148/attachment.pgp>

More information about the Freeradius-Users mailing list