[Home]

Summary:ASTERISK-26824: res_pjsip_transport_websocket: IPv6 does not work
Reporter:Jørgen H (jorgen)Labels:
Date Opened:2017-02-28 04:21:55.000-0600Date Closed:2017-03-02 17:06:54.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_transport_websocket
Versions:14.3.0 Frequency of
Occurrence
Related
Issues:
duplicatesASTERISK-26685 res_pjsip: Crash when using IPv6 and Transport ws,wss
Environment:linux x64Attachments:
Description:The websocket code registers a transport for using
pjsip_transport_register_type().
This does usually get a type value of 10 (based on index of transport_names array in pjsip).
When a websocket-connection is established using ipv6, the
pjsip_transport_type_e transport type gets set to 10 + 128(PJSIP_TRANSPORT_IPV6) due to this pjsip-patch: https://trac.pjsip.org/repos/changeset/2746

The code for retrieving the trandsport will fail since there is no transport with type 138, only 10, and asterisk will crash.

There is also a second problem with transport_create() in res/res_pjsip_transport_websocket.c :
The newtransport->transport.key.rem_addr.addr.sa_family is always set to pj_AF_INET() even in ipv6-mode. This will cause code using sockaddrs to not be able to connect to ipv6 ips because the underlying code will create an AF_INET socket instead of AF_INET6.
I commited a change for this in the other wss cleanup ticket https://gerrit.asterisk.org/#/c/4972/5/res/res_pjsip_transport_websocket.c since it is an easy fix.
Comments:By: Asterisk Team (asteriskteam) 2017-02-28 04:21:58.446-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2017-03-01 11:32:33.063-0600

The underlying issue here is that the pjsip_transport_register_type function does not support IPv6 types so an IPv6 capable WebSocket transport can be registered but can not be found. As a result when transport selection occurs it can't find the transport and fails. This will require a modification to that function to properly support IPv6 transport type registrations. Once done no other part of PJSIP would need to be modified.