I looked in the wiki for a utility function that would check if given ip address is private, but didn't find one. Does it exist?
-- Juha
Hello,
this one:
* https://www.kamailio.org/docs/modules/stable/modules/ipops.html#ipops.f.is_i...
I haven't checked if tests the newer ranges (e.g., carrier grade nat). The nat_uac_test() should have the recent ranges for non-routable ip addresses, just in case one wants to double check.
Cheers, Daniel
On 18.11.20 08:53, Juha Heinanen wrote:
I looked in the wiki for a utility function that would check if given ip address is private, but didn't find one. Does it exist?
-- Juha
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla writes:
this one:
https://www.kamailio.org/docs/modules/stable/modules/ipops.html#ipops.f.is_i...
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.
-- Juha
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_i...
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_i...
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
But these could be used:
detailed_ip_type (ip, result) detailed_ipv4_type (ip, result) detailed_ipv6_type (ip, result)
-- Juha
You can use :
is_ip_rfc1918(variable)
-------------------------------- Ángel Elena Medina _o) craem@craem.net / \ http://diablo.craem.net _(___V @craem_ www.linkedin.com/in/angel-elena-medina -------------------------------- Kopano Webapp.
-----Original message----- From: Juha Heinanen jh@tutpro.com Sent: Wednesday 18th November 2020 10:34 To: miconda@gmail.com Cc: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; users@lists.kamailio.org Subject: Re: [SR-Users] utility function to check if ip address is private?
But these could be used:
detailed_ip_type (ip, result) detailed_ipv4_type (ip, result) detailed_ipv6_type (ip, result)
-- Juha
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users