<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
On 3/26/10 4:25 PM, Uriel Rozenbaum wrote:
<blockquote
 cite="mid:69b7f9b31003260825y5a2dd328g9649827dfa184e5f@mail.gmail.com"
 type="cite">Done,<br>
  <br>
I had a lot of errors so I'll just show the final version that works OK.<br>
  <br>
&nbsp;=~ "192\.168\.([0-9]{1,3})\.([0-9]{1,3})<br>
  <br>
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.<br>
</blockquote>
<br>
I think you can reduce it to be just: "^192\.168\."<br>
<br>
Since it comes from dns server or socket attributes, then you are safe.<br>
<br>
The other option is to convert it to integer (with transformations) and
check it as net mask via bit wise operators.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
 cite="mid:69b7f9b31003260825y5a2dd328g9649827dfa184e5f@mail.gmail.com"
 type="cite"><br>
Cheers,<br>
Uriel<br>
  <br>
  <div class="gmail_quote">On Fri, Mar 26, 2010 at 11:29 AM, Uriel
Rozenbaum <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:uriel.rozenbaum@gmail.com">uriel.rozenbaum@gmail.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
Alex,<br>
    <br>
Actually what I'm trying to do is check the IPs on a request on a
Kamailio+RTPProxy acting as border of our network.<br>
    <br>
So I have the ingress IP and egress IP and need to check if I have to
bridge ii, ei, ie or ee.<br>
I managed to obtain all IPs in AVPs, but now I have to check if they
are public or private.<br>
    <br>
So far our network uses only 192.168.x.x class for private servers.<br>
    <br>
Thanks for the quick reply<br>
    <font color="#888888">Uriel</font>
    <div>
    <div class="h5"><br>
    <br>
    <div class="gmail_quote">On Fri, Mar 26, 2010 at 10:56 AM, Alex
Balashov <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>&gt;</span>
wrote:<br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><a
 moz-do-not-send="true" href="http://172.16.0.0/12" target="_blank">172.16.0.0/12</a>
does not line up on octet boundaries. &nbsp;You will need to do something
other than a regular expression. &nbsp;Fortunately, 'src_ip' is a composite
that supports comparisons against subnets in shorthand CIDR notation.<br>
      <br>
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.<br>
      <br>
--<br>
Sent from mobile device
      <div>
      <div><br>
      <br>
On Mar 26, 2010, at 9:46 AM, Uriel Rozenbaum &lt;<a
 moz-do-not-send="true" href="mailto:uriel.rozenbaum@gmail.com"
 target="_blank">uriel.rozenbaum@gmail.com</a>&gt; wrote:<br>
      <br>
      </div>
      </div>
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
        <div>
        <div>Hi guys,<br>
        <br>
Does anyone have a REGEX syntax to match a private IP on the
192.168.x.x range?<br>
        <br>
I'm trying with:<br>
if($avp(s:ip_origen)=~"192.168(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){2}"
)<br>
        <br>
But all IPs pass as private, even public ones.<br>
        <br>
Thanks!<br>
Uriel<br>
        </div>
        </div>
_______________________________________________<br>
Kamailio (OpenSER) - Users mailing list<br>
        <a moz-do-not-send="true" href="mailto:Users@lists.kamailio.org"
 target="_blank">Users@lists.kamailio.org</a><br>
        <a moz-do-not-send="true"
 href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users"
 target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</a><br>
        <a moz-do-not-send="true"
 href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users"
 target="_blank">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</a><br>
      </blockquote>
    </blockquote>
    </div>
    <br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Kamailio (OpenSER) - Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.kamailio.org">Users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</a>
<a class="moz-txt-link-freetext" href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</a></pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
Daniel-Constantin Mierla
* <a class="moz-txt-link-freetext" href="http://www.asipto.com/">http://www.asipto.com/</a> * <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a>
* <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/danielconstantinmierla">http://www.linkedin.com/in/danielconstantinmierla</a>
</div>
</body>
</html>