Done,
I had a lot of errors so I'll just show the final version that works OK.
=~ "192\.168\.([0-9]{1,3})\.([0-9]{1,3})
The only drawback is that I could pass as valid 192.168.999.999 but as these IPs come from a DNS query, I assume they'll be fine.
Cheers,
Uriel
On Fri, Mar 26, 2010 at 11:29 AM, Uriel Rozenbaum <uriel.rozenbaum@gmail.com> wrote:
Hi Alex,
Actually what I'm trying to do is check the IPs on a request on a Kamailio+RTPProxy acting as border of our network.
So I have the ingress IP and egress IP and need to check if I have to bridge ii, ei, ie or ee.
I managed to obtain all IPs in AVPs, but now I have to check if they are public or private.
So far our network uses only 192.168.x.x class for private servers.
Thanks for the quick reply
Uriel
On Fri, Mar 26, 2010 at 10:56 AM, Alex Balashov <abalashov@evaristesys.com> wrote:
172.16.0.0/12 does not line up on octet boundaries. You will need to do something other than a regular expression. Fortunately, 'src_ip' is a composite that supports comparisons against subnets in shorthand CIDR notation.
It might also be that whatever you are trying to accomplish can be done better some other way, but since you did not pose the question in terms of the objective, I cannot speak to that.
--
Sent from mobile device_______________________________________________Hi guys,
Does anyone have a REGEX syntax to match a private IP on the 192.168.x.x range?
I'm trying with:
if($avp(s:ip_origen)=~"192.168(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){2}" )
But all IPs pass as private, even public ones.
Thanks!
Uriel
Kamailio (OpenSER) - Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
_______________________________________________ Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users