Crash on iOS with NAT64 network

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Investigating the cause of the crash further;

When there is no internet connection, pj_getaddrinfo() returns PJ_ERESOLVE.

When connected to a NAT64 + DNS64 network, pj_getaddrinfo() returns PJ_SUCCESS
but no results are returned - count is set to 0.

pjsip_resolve() assumes that if pj_getaddrinfo() returns PJ_SUCCESS then a
valid pj_addrinfo was returned, and does not check the value of count. This
results in a failed assertion when calling pj_sockaddr_set_port().

I'm not sure whether the fault lies in pj_getaddrinfo() or pjsip_resolve(),
but a trivial fix is to add a check for the value of count after calling
pj_getaddrinfo():

	/* Resolve */
	count = 1;
	status = pj_getaddrinfo(af, &target->addr.host, &count, &ai);
	if (status != PJ_SUCCESS || count != 1) {
	/* "Normalize" error to PJ_ERESOLVE. This is a special error
	 * because it will be translated to SIP status 502 by
	 * sip_transaction.c
	 */
	status = PJ_ERESOLVE;
	goto on_error;
	}


I would encourage bumping the priority of #419 (ipv6 DNS) for inclusion in
2.5 if at all possible, since Apple will soon be making support of ipv6-only
networks a requirement for app submission. Anyone building pjsip into an app
will need this support.

- https://developer.apple.com/news/?id=08282015a

Regards,
Nick



> On 29 Jan 2016, at 04:49, Riza Sulistyo <riza at pjsip.org> wrote:
> 
> Hi Nick,
> 
> We have open ticket for ipv6 in (#419) and (#422). 
> We are thinking about bumping the priority of one of the ticket to 2.6, 
> however it's not decided yet at the moment.
> 
> Best Regards,
> 
> Riza
> 
> On Fri, Jan 29, 2016 at 8:59 AM, Riza Sulistyo <riza at pjsip.org> wrote:
> Hi Nick,
> 
> Unfortunately, support for DNS (ipv6) is currently not on our roadmap since we have a workaround.
> However if you are interested in implementing it, we are open to the patch.
> 
> Best Regards,
> 
> Riza
> 
> On Wed, Jan 27, 2016 at 11:26 PM, Nick Dowell <nick at nickdowell.com> wrote:
> Thanks Riza,
> 
> By resolving the server's ipv6 address and specifying that as the proxy, I have been able to get pjsip to connect over ipv6.
> 
> Is there a plan for when ipv6 will be fully supported and enabled by default in pjsip?
> 
> FYI here are the logs and call stack for the failed assertion that occurs when an ipv6 address is not specified for the proxy;
> 
> 13:29:31.804 os_core_unix.c !pjlib 2.4.5 for POSIX initialized
> 13:29:31.810 sip_endpoint.c  .Creating endpoint instance...
> 13:29:31.811          pjlib  .select() I/O Queue created (0x12d092628)
> 13:29:31.811 sip_endpoint.c  .Module "mod-msg-print" registered
> 13:29:31.812 sip_transport.  .Transport manager created.
> 13:29:31.812   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
> 13:29:31.812 sip_endpoint.c  .Module "mod-pjsua-log" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-tsx-layer" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-stateful-util" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-ua" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-100rel" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-pjsua" registered
> 13:29:31.813 sip_endpoint.c  .Module "mod-invite" registered
> 13:29:31.839 coreaudio_dev.  .. dev_id 0: iPhone IO device  (in=1, out=1) 8000Hz
> 13:29:31.845 coreaudio_dev.  ..core audio initialized
> 13:29:31.845          pjlib  ..select() I/O Queue created (0x12d093628)
> 13:29:31.847  speex_codec.c  ..Adjusting quality to 5 for uwb
> 13:29:31.847   conference.c  ..Creating conference bridge with 12 ports
> 13:29:31.847   Master/sound  ..Using delay buffer with WSOLA.
> 13:29:31.863 sip_endpoint.c  .Module "mod-evsub" registered
> 13:29:31.863 sip_endpoint.c  .Module "mod-presence" registered
> 13:29:31.863        evsub.c  .Event pkg "presence" registered by mod-presence
> 13:29:31.863 sip_endpoint.c  .Module "mod-mwi" registered
> 13:29:31.863        evsub.c  .Event pkg "message-summary" registered by mod-mwi
> 13:29:31.863 sip_endpoint.c  .Module "mod-refer" registered
> 13:29:31.863        evsub.c  .Event pkg "refer" registered by mod-refer
> 13:29:31.863 sip_endpoint.c  .Module "mod-pjsua-pres" registered
> 13:29:31.863 sip_endpoint.c  .Module "mod-pjsua-im" registered
> 13:29:31.863 sip_endpoint.c  .Module "mod-pjsua-options" registered
> 13:29:31.863   pjsua_core.c  .No SIP worker threads created
> 13:29:31.863   pjsua_core.c  .pjsua version 2.4.5 for  initialized
> 13:29:31.863   pjsua_core.c  .PJSUA state changed: CREATED --> INIT
> 13:29:31.865   pjsua_core.c  SIP UDP socket reachable at 10.4.45.223:64335
> 13:29:31.865 udp0x12cd73c90  SIP UDP transport started, published address is 10.4.45.223:64335
> 13:29:31.865    tcptp:55928  SIP TCP listener ready for incoming connections at 10.4.45.223:55928
> 13:29:31.866    tlstp:55929  SIP TLS listener is ready for incoming connections at 10.4.45.223:55929
> 13:29:31.866   pjsua_core.c  SIP UDP socket reachable at 2001:2::aab1:89b7:1c58:b1c0:860f:64336
> 13:29:31.866 udpv60x12cd732  SIP UDP IPv6 transport started, published address is [2001:2::aab1:89b7:1c58:b1c0:860f]:64336
> 13:29:31.866    tcptp:55930  SIP TCP listener ready for incoming connections at 2001:2::aab1:89b7:1c58:b1c0:860f:55930
> 13:29:31.867    tlstp:55931  SIP TLS listener is ready for incoming connections at 2001:2::aab1:89b7:1c58:b1c0:860f:55931
> 13:29:31.868   pjsua_core.c  PJSUA state changed: INIT --> STARTING
> 13:29:31.868 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
> 13:29:31.868   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
> 13:29:31.868    pjsua_acc.c  Adding account: id=sip:****@****
> 13:29:31.868    pjsua_acc.c  .Account sip:****@**** added with id 0
> 13:29:31.868    pjsua_acc.c  .Acc 0: setting registration..
> 13:29:31.869 sip_transport.  ..Warning: unable to determine local interface, fallback to default interface!
> Assertion failed: (a->addr.sa_family == PJ_AF_INET || a->addr.sa_family == PJ_AF_INET6), function pj_sockaddr_get_len, file ../src/pj/sock_common.c, line 388.
> 
> 
> backtrace:
> 
> pj_sockaddr_get_len + 204 at sock_common.c:387
> pjsua_acc_get_uac_addr + 1264 at pjsua_acc.c:3159
> pjsua_acc_create_uac_contact + 288 at pjsua_acc.c:3252
> pjsua_regc_init + 444 at pjsua_acc.c:2341
> pjsua_acc_set_registration + 608 at pjsua_acc.c:2523
> pjsua_acc_add + 1592 at pjsua_acc.c:487
> 
> 
> config_site.h:
> 
> #define PJ_CONFIG_IPHONE 1
> #define PJ_HAS_IPV6 1
> #include <pj/config_site_sample.h>
> 
> 
> 
> > On 27 Jan 2016, at 05:24, Riza Sulistyo <riza at pjsip.org> wrote:
> >
> > Hi Nick,
> >
> > I assume you have followed the guide, as described here.
> >
> > The pages states that DNS resolution for ipv6 is still not supported.
> > Hence you need to resolve any address on app and pass the IP to the stack.
> >
> > If you are still having trouble afterwards, the logs (level 5), call stack and build settings will be helpful.
> >
> > Best Regards,
> >
> > Riza
> >
> > On Tue, Jan 26, 2016 at 5:43 PM, Nick Dowell <nick at nickdowell.com> wrote:
> > Crash observed with pjsip 2.4.5, but this has been reported previously, here;
> > http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2015-July/018518.html
> >
> > Steps to reproduce;
> > 1. Create a NAT64 network using Mac OS X 10.11 - https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW16
> > 2. Connect iPhone to newly created NAT64 Wi-Fi network
> > 3. Open an app using pjsip on the iPhone
> >
> > This results in the following failed assertion and causes the app to abort
> >
> > Assertion failed: (a->addr.sa_family == PJ_AF_INET || a->addr.sa_family == PJ_AF_INET6), function pj_sockaddr_get_len, file ../src/pj/sock_common.c, line 388.
> >
> >
> > _______________________________________________
> > Visit our blog: http://blog.pjsip.org
> >
> > pjsip mailing list
> > pjsip at lists.pjsip.org
> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> >
> >
> > _______________________________________________
> > Visit our blog: http://blog.pjsip.org
> >
> > pjsip mailing list
> > pjsip at lists.pjsip.org
> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> 
> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4112 bytes
Desc: not available
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20160202/cbc0bd34/attachment.p7s>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux