cidr cast

Herwin Weststrate herwin at quarantainenet.nl
Wed Apr 15 11:18:12 CEST 2015


On 15-04-15 10:29, Peter Balsianok wrote:
> Hi,
> 
> May i use cid cast also for NAP-IP-Address ?
> 
> if (<cidr>&NAS-IP-Address == 192.168.0.0/24) {
> 
> From change log 3.0.x:
> 
> One useful thing which i'm not sure Alan has implemented yet is:
> 
> if (<cidr>&Framed-IP-Address == 192.168.0.0/24) {

I have my doubt about how useful these casts are. If I have just the IP
address 192.168.0.1, there is no way to determine if casting to a CIDR
would result in 192.168.0.0/24, 192.168.0.0/16 or any other possible
value. That means we don't test for equality, but for containment with
the == operator.

Separate operators for contains/containedby might be a better idea. I
know Postgresql has them
(http://www.postgresql.org/docs/9.4/interactive/functions-net.html#CIDR-INET-OPERATORS-TABLE),
but I always have to look them up because I can never remember the syntax.

-- 
Herwin Weststrate



More information about the Freeradius-Users mailing list