rlm_sqlippool Question

Alan DeKok aland at deployingradius.com
Sun Apr 7 23:21:24 CEST 2019


On Apr 7, 2019, at 4:36 PM, Richard J Palmer <richard at merula.net> wrote:
> With each accounts call I am calling the sqlippool module. This is wasteful as most sessions on the server *currently* are not from an IP pool.
> 
> The connections that are in the pool all have Framed-IPs which are '172.x'
> 
> I have added ...
> 
> 
>   if (Framed-IP-Address =~ /172\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/) {       sqlippool
>   }
> Which seems to work and I am now only seeing the sqlippool calls when the IP is that match...
> 
> Now my knowledge of regex is not the greatest - so I would really appreciate someone here taking a quick look and saying if that looks correct

$ man unlang

       The  operators  "<",  "<=", ">", and ">=" are also allowed for checking
       that an IP address is contained within a network.  For example:

                   if (<ipaddr>192.0.2.1 < 192.0.2.0/24) {

       This comparison succeeds, because the address  192.0.2.1  is  contained
       within the network 192.0.2.0/24.

  So you can do:

	if (Framed-IP-Address < 172.0.0.0/8) {
		...
	}

  Alan DeKok.




More information about the Freeradius-Users mailing list