Cisco-AVPair regex

Kylián Martin kylianm at plzen.eu
Mon Feb 26 10:38:47 CET 2018


>   TBH, the simplest thing is to *not* use "foreach".  I'd guess that the Cisco-
> AVPair attributes come in the same order all the time.  So you can just rely on
> that.  e.g.
> 
> 	if (Cisco-AVPair[0] =~ /^dhcp-option=/) {
> 		update request {
> 			Tmp-Integer-0 := "%{unpack:&Cisco-AVPair[0] 12
> integer}"
> 		}
> 	}
> 
>   That will get you the binary data (4 octets) into Tmp-Integer-0.

Thank you Alan. It works. AVPs always come in the same order.  The unpacked data looks correctly. 
The last modest question yet - how the get the rest of the attribute (string following the TLV binary code)? 


> 
>   i.e. *manually* check that Cisco-AVPair[0] is the "dhcp-option".  Then,
> *manually* check that the binary data you want is at byte offset 12.  And
> then write an "unpack" rule to do that...
> 
>   Alan DeKok.
> 
> 
> -



More information about the Freeradius-Users mailing list