[OpenSIPS-Users] ipv6 address check
Bogdan-Andrei Iancu
bogdan at opensips.org
Wed Apr 11 05:36:35 EDT 2018
Hi Pasan,
Thanks for the testing, I just did the backports to 2.4, 2.3 and 2.2
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
OpenSIPS Summit 2018
http://www.opensips.org/events/Summit-2018Amsterdam
On 04/09/2018 07:19 AM, Pasan Meemaduma wrote:
> Hi Bogdan,
>
> Thanks for the fix. Its all good, I have tested it against both v4 and
> v6. I have comment it on the commit.
>
>
>
> On Friday, April 6, 2018, 9:43:32 PM GMT+5:30, Bogdan-Andrei Iancu
> <bogdan at opensips.org> wrote:
>
>
> Hi Pasan,
>
> Could you please see this fix:
> https://github.com/OpenSIPS/opensips/commit/dc6fa00e6c7d25f296d25b727c1074a5abefdf5d
>
> And test it to see if properly works for IPv6 and 4
>
> Thanks and regards,
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
> http://www.opensips-solutions.com
> OpenSIPS Summit 2018
> http://www.opensips.org/events/Summit-2018Amsterdam
> On 04/06/2018 11:39 AM, Pasan Meemaduma wrote:
>> 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 blatantly.
>>
>> But ip transformation functions came handy :) I used used them to
>> compare them without any hassle.
>>
>> Ex:
>> previously I had this check for comparing Via ip and source ip as below,
>>
>> if ($avp(vip) == $(si{s.escape.common}) ) {
>>
>> But ip transformation functions saved the day ! as follow,
>>
>> if ($(avp(vip){ip.pton}) == $(si{s.escape.common}{ip.pton}) ) {
>>
>>
>> I also checked there's no built in function to compare two ips other
>> than above method but didn't found.
>>
>>
>> Hope to see a fix for the function in question, and Thanks again for
>> your valued time.
>>
>>
>>
>> On Friday, April 6, 2018, 1:51:20 PM GMT+5:30, Bogdan-Andrei Iancu
>> <bogdan at opensips.org> <mailto:bogdan at opensips.org> wrote:
>>
>>
>> Hi Pasan,
>>
>> 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.
>>
>> Best regards,
>> Bogdan-Andrei Iancu
>>
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>> OpenSIPS Summit 2018
>> http://www.opensips.org/events/Summit-2018Amsterdam
>> On 04/06/2018 05:20 AM, Pasan Meemaduma wrote:
>>> Hi Bogdan,
>>>
>>> I have sent the requested details in pm.
>>>
>>> Thank you.
>>>
>>> On Thursday, April 5, 2018, 5:33:50 PM GMT+5:30, Bogdan-Andrei Iancu
>>> <bogdan at opensips.org> <mailto:bogdan at opensips.org> wrote:
>>>
>>>
>>> Pasan,
>>>
>>> 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.
>>>
>>> Thanks,
>>> Bogdan-Andrei Iancu
>>>
>>> OpenSIPS Founder and Developer
>>> http://www.opensips-solutions.com
>>> OpenSIPS Summit 2018
>>> http://www.opensips.org/events/Summit-2018Amsterdam
>>> On 04/05/2018 01:31 PM, Pasan Meemaduma wrote:
>>>> Hi Bogdan,
>>>>
>>>> I have log_level set at 9. I get no output just the xlog line that
>>>> is right after is_ip_registered func.
>>>> When the account is not registered (aor is not in ul) I get below,
>>>>
>>>> DBG:registrar:is_ip_registered: no contact found for aor=<0xx0x0x0xx>
>>>>
>>>>
>>>> I'm stuck at why it doesn't give any debug message and simply
>>>> return -1.
>>>>
>>>> On Thursday, April 5, 2018, 3:30:06 PM GMT+5:30, Bogdan-Andrei
>>>> Iancu <bogdan at opensips.org> <mailto:bogdan at opensips.org> wrote:
>>>>
>>>>
>>>> Hi Pasan,
>>>>
>>>> The fix_actions log is only at the startup, before opensips
>>>> actually starts to handle traffic. Not related I would say.
>>>>
>>>> Now, if you run in debug level (set log_level = 4), do you see any
>>>> output when the is_ip_registered() is triggered ?
>>>>
>>>> Regards,
>>>> Bogdan-Andrei Iancu
>>>>
>>>> OpenSIPS Founder and Developer
>>>> http://www.opensips-solutions.com
>>>> OpenSIPS Summit 2018
>>>> http://www.opensips.org/events/Summit-2018Amsterdam
>>>> On 04/05/2018 12:30 PM, Pasan Meemaduma via Users wrote:
>>>>> Hi Guys,
>>>>>
>>>>> Sorry I had to come back to this thread as the issue i reported
>>>>> was for a different function and problem with is_ip_registered
>>>>> func still exists. on Further investigating I found below
>>>>>
>>>>> DBG:core:fix_actions: fixing is_ip_registered,
>>>>> /etc/opensips/opensips.cfg:970
>>>>>
>>>>> and following is whats at line 970 in my config
>>>>> $var(aor) = "sip:" + $(au{s.escape.common}) + "@" +
>>>>> $(fd{s.escape.common});
>>>>> if(is_ip_registered("location","$var(aor)","$si")){
>>>>> xlog("L_INFO","Call: Auth INVITE - From=$fU from_uri=$fu
>>>>> Auth_user=$au Request=$rU IP=$si AOR=$var(aor) ID=$ci");
>>>>> } else {
>>>>> 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");
>>>>> sl_send_reply("401", "Unauthorized");
>>>>> exit;
>>>>> }
>>>>> Am I using the function in a wrong way ? whats the fix_actions do
>>>>> to the function call ?
>>>>> 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 -"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Wednesday, April 4, 2018, 4:15:11 PM GMT+5:30, Pasan Meemaduma
>>>>> <pasandev at ymail.com> <mailto:pasandev at ymail.com> wrote:
>>>>>
>>>>>
>>>>> Thanks Liviu, I have submitted a bug request
>>>>>
>>>>>
>>>>> On Wednesday, April 4, 2018, 4:07:45 PM GMT+5:30, Liviu Chircu
>>>>> <liviu at opensips.org> <mailto:liviu at opensips.org> wrote:
>>>>>
>>>>>
>>>>> Hi Pasan,
>>>>>
>>>>> Yes, if you could move it over to GitHub [1], that would be great.
>>>>> Thanks!
>>>>>
>>>>> [1]: https://github.com/OpenSIPS/opensips/issues
>>>>>
>>>>> Liviu Chircu
>>>>> OpenSIPS Developer
>>>>> http://www.opensips-solutions.com
>>>>> On 04.04.2018 13:29, Pasan Meemaduma via Users wrote:
>>>>>> Hi Guys,
>>>>>>
>>>>>> Should I open up a bug request for this ?
>>>>>>
>>>>>>
>>>>>> On Tuesday, April 3, 2018, 2:33:34 PM GMT+5:30, Pasan Meemaduma
>>>>>> via Users <users at lists.opensips.org>
>>>>>> <mailto:users at lists.opensips.org> wrote:
>>>>>>
>>>>>>
>>>>>> Hi Guys,
>>>>>>
>>>>>> 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.
>>>>>> But the function is failing with following error message.
>>>>>>
>>>>>> script function call
>>>>>> is_ip_registered("location","$var(aor)","$si"));
>>>>>>
>>>>>>
>>>>>> error message from logs.
>>>>>>
>>>>>> ERROR:permissions:check_addr_6: invalid ip set
>>>>>> <24xx:xxx:0:1:x000:0:0:2>
>>>>>>
>>>>>> There's an AOR already with that IP
>>>>>>
>>>>>> 0 [ 3/04 18:53:29] root@:/root>> opensipsctl ul show
>>>>>> Domain:: location table=512 records=1
>>>>>> AOR:: 0xxxx
>>>>>> Contact:: sip:
>>>>>> 0xxxx@[24xx:xxx:0:1:x000::2];line=180c0d2da1b3e81 Q=
>>>>>> ContactID:: 3275524303981917232
>>>>>> Expires:: 3495
>>>>>> Callid:: 490179714
>>>>>> Cseq:: 2
>>>>>> User-agent:: Linphone/3.6.1 (eXosip2/4.1.0)
>>>>>> Received:: sip:[2400:xxx:0:1:x000:0:0:2]:5060
>>>>>> State:: CS_SYNC
>>>>>> Flags:: 0
>>>>>> Cflags:: PING NAT
>>>>>> Socket:: udp:[24xx:xx0:1D:F0:0:0:1:88]:5060
>>>>>> Methods:: 4294967295
>>>>>>
>>>>>> It appears to be failing at /modules/permissions/address.c line
>>>>>> 517 . looks like str2ip in line 515 doesn't return a valid ip.
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20180411/7c6b4a6e/attachment-0001.html>
More information about the Users
mailing list