Help testing if a variable contains an IPv4

Alan DeKok aland at
Sat Jun 12 19:25:11 CEST 2021

On Jun 12, 2021, at 1:11 PM, David Herselman via Freeradius-Users <freeradius-users at> wrote
> Many thanks, the following now works as expected:

  That's good.

> What it however does allow is for someone to set a DNS PTR record for their source IP as a hostname that would resolve to an IP in the subnet. I presume I should limit validation to numeric values only by first validating Calling-Station-Id =~ /^\d{1,3}(\.\d{1,3}){3}$/ ?

  You should do whatever validation you need.  The above regex doesn't match host names.  So...

  You need to think of what you *want* to happen, and allow that.  Then, forbid everything else.

  Alan DeKok.

More information about the Freeradius-Users mailing list