<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div>Hi Bogdan,</div><div><br></div><div>Thanks for the fix. Its all good, I have tested it against both v4 and v6. I have comment it on the commit.</div><div><br></div>
<div><br></div><div><br></div>
<div id="yahoo_quoted_3463543916" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Friday, April 6, 2018, 9:43:32 PM GMT+5:30, Bogdan-Andrei Iancu <bogdan@opensips.org> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv7244117279"><div>
<tt>Hi Pasan,<br clear="none">
<br clear="none">
Could you please see this fix:<br clear="none">
<a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-freetext" target="_blank" href="https://github.com/OpenSIPS/opensips/commit/dc6fa00e6c7d25f296d25b727c1074a5abefdf5d">https://github.com/OpenSIPS/opensips/commit/dc6fa00e6c7d25f296d25b727c1074a5abefdf5d</a><br clear="none">
<br clear="none">
And test it to see if properly works for IPv6 and 4<br clear="none">
<br clear="none">
Thanks and regards,<br clear="none">
</tt>
<pre class="yiv7244117279moz-signature">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Summit 2018
<a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-freetext" target="_blank" href="http://www.opensips.org/events/Summit-2018Amsterdam">http://www.opensips.org/events/Summit-2018Amsterdam</a>
</pre>
<div class="yiv7244117279yqt5669286380" id="yiv7244117279yqt58277"><div class="yiv7244117279moz-cite-prefix">On 04/06/2018 11:39 AM, Pasan Meemaduma
wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Yup, I had a similar issue when I wanted to compare ip in
Via header against source ip at the script level, and If I
just compare them, its a string comparison and fails <span><span>blatantly</span></span>.</div>
<div><br clear="none">
</div>
<div>But ip transformation functions came handy :) I used used
them to compare them without any hassle. </div>
<div><br clear="none">
</div>
<div>Ex: </div>
<div>previously I had this check for comparing Via ip and source
ip as below,<br clear="none">
</div>
<div><br clear="none">
</div>
<div><span> if ($avp(vip) == $(si{s.escape.common}) ) {<br clear="none">
</span></div>
<div><span><br clear="none">
</span>But ip transformation functions saved the day ! as
follow,<br clear="none">
</div>
<div><br clear="none">
</div>
<div><span> <span> if ($(avp(vip){ip.pton}) ==
$(si{s.escape.common}{ip.pton}) ) {<br clear="none">
</span></span></div>
<div><span><span><br clear="none">
</span></span></div>
<div><span><span><br clear="none">
</span>I also checked there's no built in function to
compare two ips other than above method but didn't found.<br clear="none">
</span><br clear="none">
</div>
<div><br clear="none">
</div>
<div>Hope to see a fix for the function in question, and Thanks
again for your valued time.</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div class="yiv7244117279yahoo_quoted" id="yiv7244117279yahoo_quoted_3849656002">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On Friday, April 6, 2018, 1:51:20 PM GMT+5:30,
Bogdan-Andrei Iancu <a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-rfc2396E" ymailto="mailto:bogdan@opensips.org" target="_blank" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a> wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279">
<div> <tt>Hi Pasan,<br clear="none">
<br clear="none">
Thanks for the info. It is exactly what I suspected
- the check between the IP extracted from contact /
received field and the provided IP is done as
strings and the enclosing of IPv6 makes the comp to
fail. I guess this needs to be rework to do ip comp,
not string comp.<br clear="none">
<br clear="none">
Best regards,<br clear="none">
</tt>
<pre class="yiv7244117279moz-signature">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Summit 2018
<a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-freetext" target="_blank" href="http://www.opensips.org/events/Summit-2018Amsterdam">http://www.opensips.org/events/Summit-2018Amsterdam</a>
</pre>
<div class="yiv7244117279yqt8118275857" id="yiv7244117279yqt21913">
<div class="yiv7244117279moz-cite-prefix">On
04/06/2018 05:20 AM, Pasan Meemaduma wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Hi Bogdan,</div>
<div><br clear="none">
</div>
<div>I have sent the requested details in pm.</div>
<div><br clear="none">
</div>
<div>Thank you.<br clear="none">
</div>
<div><br clear="none">
</div>
<div class="yiv7244117279ydpf4d16519yahoo_quoted" id="yiv7244117279ydpf4d16519yahoo_quoted_3248390248">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On Thursday, April 5, 2018, 5:33:50 PM
GMT+5:30, Bogdan-Andrei Iancu <a rel="nofollow" shape="rect" class="yiv7244117279moz-txt-link-rfc2396E" ymailto="mailto:bogdan@opensips.org" target="_blank" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a>
wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279ydpf4d16519yiv6363013759">
<div> <tt>Pasan,<br clear="none">
<br clear="none">
Please print via xlog the $si just
before doing the is_ip_registered()
check. Also, do an "opensipsctl ul
show" after the registration and
before the test call. I want to see
the values that are internally
compared.<br clear="none">
<br clear="none">
Thanks,<br clear="none">
</tt>
<pre class="yiv7244117279ydpf4d16519yiv6363013759moz-signature">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Summit 2018
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://www.opensips.org/events/Summit-2018Amsterdam">http://www.opensips.org/events/Summit-2018Amsterdam</a>
</pre>
<div class="yiv7244117279ydpf4d16519yiv6363013759yqt3403483008" id="yiv7244117279ydpf4d16519yiv6363013759yqt53801">
<div class="yiv7244117279ydpf4d16519yiv6363013759moz-cite-prefix">On
04/05/2018 01:31 PM, Pasan
Meemaduma wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Hi Bogdan,</div>
<div><br clear="none">
</div>
<div>I have log_level set at 9.
I get no output just the xlog
line that is right after
is_ip_registered func.</div>
<div>When the account is not
registered (aor is not in ul)
I get below,</div>
<div><br clear="none">
</div>
<div><span>DBG:registrar:is_ip_registered:
no contact found for
aor=<0xx0x0x0xx></span><br clear="none">
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>I'm stuck at why it doesn't
give any debug message and
simply return -1.</div>
<div><br clear="none">
</div>
<div class="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted" id="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted_3873350602">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On Thursday, April 5,
2018, 3:30:06 PM GMT+5:30,
Bogdan-Andrei Iancu <a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-rfc2396E" ymailto="mailto:bogdan@opensips.org" target="_blank" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a>
wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279ydpf4d16519yiv6363013759">
<div> <tt>Hi Pasan,<br clear="none">
<br clear="none">
The fix_actions log
is only at the
startup, before
opensips actually
starts to handle
traffic. Not related
I would say.<br clear="none">
<br clear="none">
Now, if you run in
debug level (set
log_level = 4), do
you see any output
when the
is_ip_registered()
is triggered ?<br clear="none">
<br clear="none">
Regards,<br clear="none">
</tt>
<pre class="yiv7244117279ydpf4d16519yiv6363013759moz-signature">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Summit 2018
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://www.opensips.org/events/Summit-2018Amsterdam">http://www.opensips.org/events/Summit-2018Amsterdam</a>
</pre>
<div class="yiv7244117279ydpf4d16519yiv6363013759yqt5150986033" id="yiv7244117279ydpf4d16519yiv6363013759yqt83891">
<div class="yiv7244117279ydpf4d16519yiv6363013759moz-cite-prefix">On
04/05/2018 12:30
PM, Pasan
Meemaduma via
Users wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Hi Guys,</div>
<div><br clear="none">
</div>
<div>Sorry I had
to come back
to this thread
as the issue i
reported was
for a
different
function and
problem with <span><span>is_ip_registered</span></span>
func still
exists. on
Further
investigating
I found below<br clear="none">
</div>
<div><br clear="none">
</div>
<div><span> </span>
<p>DBG:core:fix_actions:
fixing
is_ip_registered,
/etc/opensips/opensips.cfg:970</p>
<p>and
following is
whats at line
970 in my
config<br clear="none">
$var(aor) =
"sip:" +
$(au{s.escape.common})
+ "@" +
$(fd{s.escape.common});<br clear="none">
if(is_ip_registered("location","$var(aor)","$si")){<br clear="none">
xlog("L_INFO","Call: Auth INVITE - From=$fU from_uri=$fu Auth_user=$au
Request=$rU
IP=$si
AOR=$var(aor)
ID=$ci");<br clear="none">
} else {<br clear="none">
xlog("L_WARN","Call: Auth INVITE from Unregistered IP - From=$fU
from_uri=$fu
Auth_user=$au
Request=$rU
IP=$si
Via=$avp(vip)
AOR=$var(aor)
ID=$ci");<br clear="none">
sl_send_reply("401", "Unauthorized");<br clear="none">
exit;<br clear="none">
}<br clear="none">
Am I using the
function in a
wrong way ?
whats the
fix_actions do
to the
function call
?<br clear="none">
And when I
make a test
call I can't
see
is_ip_registered
func getting
call in debug
log. It only
prints my
debug line
which is
"Call: Auth
INVITE from
Unregistered
IP -"</p>
<br clear="none">
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div class="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted" id="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted_2945121261">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On
Wednesday,
April 4, 2018,
4:15:11 PM
GMT+5:30,
Pasan
Meemaduma <a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-rfc2396E" ymailto="mailto:pasandev@ymail.com" target="_blank" href="mailto:pasandev@ymail.com"><pasandev@ymail.com></a> wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279ydpf4d16519yiv6363013759">
<div>
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Thanks
Liviu, I have
submitted a bu<span></span>g
request<br clear="none">
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div class="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted" id="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted_2959194294">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div class="yiv7244117279ydpf4d16519yiv6363013759yqt7796149435" id="yiv7244117279ydpf4d16519yiv6363013759yqt45489">
<div> On
Wednesday,
April 4, 2018,
4:07:45 PM
GMT+5:30,
Liviu Chircu <a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-rfc2396E" ymailto="mailto:liviu@opensips.org" target="_blank" href="mailto:liviu@opensips.org"><liviu@opensips.org></a> wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279ydpf4d16519yiv6363013759">
<div>
<p><tt>Hi
Pasan,</tt></p>
<p><tt>Yes, if
you could move
it over to
GitHub [1],
that would be
great. Thanks!<br clear="none">
</tt></p>
<p><tt>[1]: <a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="https://github.com/OpenSIPS/opensips/issues">https://github.com/OpenSIPS/opensips/issues</a></tt><br clear="none">
</p>
<pre class="yiv7244117279ydpf4d16519yiv6363013759moz-signature">Liviu Chircu
OpenSIPS Developer
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<div class="yiv7244117279ydpf4d16519yiv6363013759yqt7939372314" id="yiv7244117279ydpf4d16519yiv6363013759yqt36361">
<div class="yiv7244117279ydpf4d16519yiv6363013759moz-cite-prefix">On
04.04.2018
13:29, Pasan
Meemaduma via
Users wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Hi Guys,</div>
<div><br clear="none">
</div>
<div>Should I
open up a bug
request for
this ?<br clear="none">
</div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div class="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted" id="yiv7244117279ydpf4d16519yiv6363013759yahoo_quoted_2903066138">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On
Tuesday, April
3, 2018,
2:33:34 PM
GMT+5:30,
Pasan
Meemaduma via
Users <a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-rfc2396E" ymailto="mailto:users@lists.opensips.org" target="_blank" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a> wrote: </div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
<div>
<div id="yiv7244117279ydpf4d16519yiv6363013759">
<div>
<div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">
<div>Hi Guys,</div>
<div><br clear="none">
</div>
<div>I'm
testing ipv6
on opensips
2.3. and I'm
using the
following
script
function to
findout if the
requesting ip
is already
registered
with that ip.</div>
<div>But the
function is
failing with
following
error message.</div>
<div><br clear="none">
</div>
<div>script
function call</div>
<div><span>is_ip_registered("location","$var(aor)","$si"));</span></div>
<div><span><br clear="none">
</span><br clear="none">
</div>
<div>error
message from
logs.<br clear="none">
</div>
<div><span><br clear="none">
</span></div>
<div><span>ERROR:permissions:check_addr_6:
invalid ip set
<24xx:xxx:0:1:x000:0:0:2></span></div>
<div><br clear="none">
</div>
<div>There's
an AOR already
with that IP</div>
<div><br clear="none">
</div>
<div><span>0 [
3/04 18:53:29]
root@:/root>> opensipsctl ul show<br clear="none">
Domain::
location
table=512
records=1<br clear="none">
AOR::
0xxxx<br clear="none">
Contact:: sip: <span><span>0xxxx</span></span>@[24xx:xxx:0:1:x000::2];line=180c0d2da1b3e81
Q=<br clear="none">
ContactID:: 3275524303981917232<br clear="none">
Expires:: 3495<br clear="none">
Callid:: 490179714<br clear="none">
Cseq:: 2<br clear="none">
User-agent:: Linphone/3.6.1 (eXosip2/4.1.0)<br clear="none">
Received:: sip:[2400:xxx:0:1:x000:0:0:2]:5060<br clear="none">
State:: CS_SYNC<br clear="none">
Flags:: 0<br clear="none">
Cflags:: PING NAT<br clear="none">
Socket:: udp:[24xx:xx0:1D:F0:0:0:1:88]:5060<br clear="none">
Methods:: 4294967295<br clear="none">
<br clear="none">
</span></div>
<div>It
appears to be
failing at <span>/modules/permissions/address.c
line 517 .
looks like <span><span class="yiv7244117279ydpf4d16519yiv6363013759ydp2c2d2970pl-c1">str2ip</span></span>
in line 515
doesn't return
a valid ip.</span><br clear="none">
</div>
</div>
</div>
</div>
_______________________________________________<br clear="none">
Users mailing
list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br clear="none">
</div>
</div>
</div>
</div>
<br clear="none">
<fieldset class="yiv7244117279ydpf4d16519yiv6363013759mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
Users mailing list
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-abbreviated" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
<br clear="none">
</div>
</div>
<div class="yiv7244117279ydpf4d16519yiv6363013759yqt7939372314" id="yiv7244117279ydpf4d16519yiv6363013759yqt92387">_______________________________________________<br clear="none">
Users mailing
list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br clear="none">
<fieldset class="yiv7244117279ydpf4d16519yiv6363013759mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
Users mailing list
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-abbreviated" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a rel="nofollow" shape="rect" class="yiv7244117279ydpf4d16519yiv6363013759moz-txt-link-freetext" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
<br clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="none">
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div>
<br clear="none">
</div></div></div>
</div>
</div></div></body></html>