AVPair extraction
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Tue Oct 20 20:30:59 CEST 2015
> On Oct 20, 2015, at 2:09 PM, Alan DeKok <aland at deployingradius.com> wrote:
>
> On Oct 19, 2015, at 6:55 PM, Alan Batie <alan at peak.org> wrote:
>>
>> On 10/19/15 2:41 PM, Arran Cudbard-Bell wrote:
>>
>>> }
>>> elsif ("%{Foreach-Variable-0}" =~ /^nas-tx-speed=(.+)/ ) {
>>
>>
>>> Note the new lines :)
>>
>> Ooook, progress -
>> now I get "Failed to find "foreach" in the "modules" section."
>
> Use v3. "foreach" is a key word in that version.
>
> In v2... write a Perl program to do the re-writing.
Ah, yes, I assumed it was v3 as foreach was being used.
In v3.1.x you can also do
if (&Cisco-AVPair[*] =~ /^client-mac-address=(.+)/) {
update request {
Calling-Station-ID := "%{1}"
}
}
or
foreach &Stupid-VSA {
if ("%{Foreach-variable-0}" =~ /^([^=]+)=(.+)$/) {
update {
"%{1}" = "%{2}"
}
}
}
(if you define VSAs that match the attributes encapsulated in Stupid-VSA)
Note: You need to define attributes in the dictionaries before they can be used in the config, so it's best to map the Cisco attributes to RFC attrs that are already defined.
Some vendors which only provide a stupid <attr>=<value> VSA, in v3.1.x, you can add real VSAs to those dictionaries and unpack the stupid text attributes into proper VSAs.
-Arran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20151020/9e5d015e/attachment.sig>
More information about the Freeradius-Users
mailing list