If statement regex match with multiple similar attributes
jberry at plus.net
jberry at plus.net
Wed Jan 7 09:49:54 CET 2015
Hi there,
Freeradius version: 2.2.5
I have a question relating to how if statements applied to a packet are
handled.
I have a packet something like this (I¹ve snipped a load of stuff) that
contains 2 class attributes:
Framed-Protocol = PPP
Class = 0x5030323a3***************************************
...
Class = 0x434653494421****************
...
I am trying to overwrite some attributes in the post-auth section based on
a Class attribute matching a given string being present. I can get this
working like so using a sting comparison on the hex:
if( reply:Class =~ /^0x5030323a3/ ) {
update reply {
...
}
}
What I can¹t get to work is making the if statement check the second Class
attribute (the one I actually want to check!). It is not feasible to
change the order they appear because of the complexity of the system (and
tbh I would probably not want to assume it would always be second). So if
I go with:
if( reply:Class =~ /^0x434653494421/ ) {
update reply {
...
}
}
The debug shows it trying and failing to match
++? if (reply:Class =~ /0x434653494421/ )
? Evaluating (reply:Class =~ /0x434653494421/) -> FALSE
++? if (reply:Class =~ /0x434653494421/ ) -> FALSE
Any ideas? I can¹t find anything in the docs or on google (mainly because
its a really hard search term)
Thanks,
--
Josh Berry
Senior Systems Engineer
Plusnet PLC | www.plus.net
Phone: 01142 733547
Registered Office: The Balance | 2 Pinfold Street | Sheffield | S1 2GU
Registered in England no: 3279013
More information about the Freeradius-Users
mailing list