Verifying framed-ip-address using unlang

Arran Cudbard-Bell A.Cudbard-Bell at sussex.ac.uk
Mon Jan 14 11:47:46 CET 2008


Alan DeKok wrote:
> Pshem Kowalczyk wrote:
>> Is it possible to use unlang to verify whether framed-ip-address is in
>> the right range or not?
> 
>   Yes and no.  The comparisons are not typed, so everything is a string.
> 
>> We would like to use it on our wholesale proxies. Wholesale customers
>> of ours are allowed to allocate IPs to their customers, but only from
>> certain ranges. Will a normal comparison (> <) work with IP addresses?
> 
>   They will "work", but they won't do IP-address comparison.
> 
>   You can either do string comparisons, which will often do the right
> thing, OR regular expressions, which will do the right thing if you
> write them carefully.

Sub Captures of regular expressions map onto variables %{1}-%{8}, so you 
can extract the individual octets of the IP address. So if you wanted to 
check multiple ranges, best thing is to extract the octets of the IP 
address and then do the comparison with normal < = > operators.
> 
>   Alan DeKok.
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list