[Asterisk-code-review] res pjsip transport websocket: Properly set src name for IPv6 (asterisk[16])

Joshua Colp asteriskteam at digium.com
Thu Aug 30 05:08:57 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/9986 )

Change subject: res_pjsip_transport_websocket: Properly set src_name for IPv6
......................................................................

res_pjsip_transport_websocket: Properly set src_name for IPv6

SIP responses over WebSockets when the client is using IPv6 have invalid
Via headers according to RFC 3261. The 'received' header parameter
should not be wrapped in brackets if it is an IPv6 address.

When src_name is populated by the built-in PJSIP transports, the code
uses pj_sockaddr_print() with 'flags' set to 0, meaning that the
brackets are not rendered around IPv6 addresses.

This may be related to ASTERISK~27101.

See also: https://github.com/onsip/SIP.js/pull/594

ASTERISK-28020 #close

Change-Id: I8ea9d289901b837512bee2ca2535e3dc14f04d77
---
M res/res_pjsip_transport_websocket.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c
index 6335943..75869f5 100644
--- a/res/res_pjsip_transport_websocket.c
+++ b/res/res_pjsip_transport_websocket.c
@@ -293,7 +293,7 @@
 	pj_sockaddr_parse(pj_AF_UNSPEC(), 0, pj_cstr(&buf, ast_sockaddr_stringify(ast_websocket_remote_address(session))), &rdata->pkt_info.src_addr);
 	rdata->pkt_info.src_addr_len = sizeof(rdata->pkt_info.src_addr);
 
-	pj_ansi_strcpy(rdata->pkt_info.src_name, ast_sockaddr_stringify_host(ast_websocket_remote_address(session)));
+	pj_ansi_strcpy(rdata->pkt_info.src_name, ast_sockaddr_stringify_addr(ast_websocket_remote_address(session)));
 	rdata->pkt_info.src_port = ast_sockaddr_port(ast_websocket_remote_address(session));
 
 	recvd = pjsip_tpmgr_receive_packet(rdata->tp_info.transport->tpmgr, rdata);

-- 
To view, visit https://gerrit.asterisk.org/9986
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: merged
Gerrit-Change-Id: I8ea9d289901b837512bee2ca2535e3dc14f04d77
Gerrit-Change-Number: 9986
Gerrit-PatchSet: 7
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180830/8d52b5a2/attachment.html>


More information about the asterisk-code-review mailing list