Matching a value within an IP subnet

Brian Candler B.Candler at pobox.com
Tue Oct 19 13:56:30 CEST 2010


On Mon, Oct 18, 2010 at 02:51:25PM +0200, Alan DeKok wrote:
> Brian Candler wrote:
> > DEFAULT		NAS-IP-Address =~ 192.0.2.0/27, NAS-Group := "ADSL-BRAS"
> > 
> > I've had a look at paircmp() in src/lib/valuepair.c and can't see any logic
> > which might do this.
> 
>   Nope.  Write a regex to do the matching.  The above string after "=~"
> is *not* a regex.

Indeed it is not. But NAS-IP-Address is (natively) not a string in RADIUS
either, it's a 4-byte integer.  Does FreeRADIUS let me treat it as if it
were a string?

DEFAULT		NAS-IP-Address =~ /^192\.0\.2\.([0-9]|1[0-9]|2[0-9]|3[01])$/, NAS-Group := "ADSL-BRAS"

B.



More information about the Freeradius-Users mailing list