multiply Cisco-AVPair request attribute process by regular expression

Olivier Beytrison olivier at heliosnet.org
Sun Apr 28 23:18:55 CEST 2013



On 28 avr. 2013, at 22:58, Mehdi Ravanbakhsh <babakco at gmail.com> wrote:

> Dear 
> A.L.M.Buxey
> 
> i have 2 Cisco-AVPair in request attribute :
> 
> Cisco-AVPair = "client-mac-address=90f6.52d2.384f"
> 
> and
> 
> Cisco-AVPair = "circuit-id-tag=Azadegan-1 atm 2/16:251:0.35"

You have multiple time the same attribute. Use Cisco-AVPair[X] to access a specific instance of them. If you're running version 3 you can use a foreach loop

> 
> for first one i use :  
> 
> 
>              if (Cisco-AVpair =~ /^client-mac-address=([a-f0-9]
> [a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9]).([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])$/) {
>                      if (!Calling-Station-Id) {
>                             update request {
>                                     Calling-Station-Id := "%{1}:%{2}:%{3}:%{4}:%{5}:%{6}"
>                                     Called-Station-Id := "%{NAS-Identifier}"
>                             }
> 
>                      }
>                }
> 
> and it is work
> 
> 
> for second one i use :
> 
>     if (Cisco-AVPair =~ /^circuit-id-tag=(.*)$/)  {
>                      
>                             update request {
>                                     NAS-Port-Id := "%{1}"
>                             }     
>      }
> 
> But it is not work !!!!!
> 
> that is the problem.
> 
> this is the attribute that come from NAS :
> 
>     Acct-Session-Id = "04423124"
>     Cisco-AVPair = "client-mac-address=90f6.52d2.384f"
>     Framed-Protocol = PPP
>     Framed-IP-Address = 172.20.10.238
>     User-Name = "7734247799"
>     Cisco-AVPair = "connect-progress=LAN Ses Up"
>     Acct-Authentic = RADIUS
>     Acct-Status-Type = Start
>     NAS-Port-Type = Ethernet
>     NAS-Port = 71446820
>     NAS-Port-Id = "0/0/0/0"
>     Cisco-AVPair = "circuit-id-tag=Azadegan-1 atm 2/16:251:0.35"
>     Service-Type = Framed-User
>     NAS-IP-Address = 10.150.21.218
>     X-Ascend-Session-Svr-Key = "A4477F54"
>     Acct-Delay-Time = 29
>     Calling-Station-Id = ""
>     Called-Station-Id = ""
>     Acct-Unique-Session-Id = "8cd7eadca98e09bf"
>     Timestamp = 1367151426
> 
> 
> Best regards
> 
> 
> On Mon, Apr 29, 2013 at 1:10 AM, <A.L.M.Buxey at lboro.ac.uk> wrote:
>> Hi,
>> 
>> >    but it is not working !
>> 
>> what do you mean? what do you want to do (ie what do you want to have/get
>> and what do you actually get?) - what does the server say/do (ie. run in full
>> debug mode to see what its saying/doing to your logic.
>> 
>> alan
>> -
>> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
> 
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20130428/1d6924ac/attachment-0001.html>


More information about the Freeradius-Users mailing list