[SR-Users] utility function to check if ip address is private?
Daniel-Constantin Mierla
miconda at gmail.com
Wed Nov 18 10:34:01 CET 2020
On 18.11.20 10:17, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> this one:
>> https://www.kamailio.org/docs/modules/stable/modules/ipops.html#ipops.f.is_ip_rfc1918
> If it is really is based on RFC1918, then I doubt that it would handle
> IPv6 private addresses, since when that RFC was written, IPv6 didn't
> exist.
I haven't implemented the function, so I cannot comment more about its
internals, but you can chain it with the match of subnet for private
ipv6 using:
*
https://www.kamailio.org/docs/modules/stable/modules/ipops.html#ipops.f.is_in_subnet
Of course, you can add a new function, if you want. An alternative
coming in my mind is to add the subnets in address table grouped with an
id that you use with allow_source_address().
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
More information about the sr-users
mailing list