From: Scott Griepentrog Date: Thu, 10 Aug 2017 14:09:29 +0000 (-0500) Subject: res_pjsip_messaging: IPv6 receive address needs brackets X-Git-Tag: 13.18.0-rc1~98^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22575b6342277cb44b5a84403f594e8deae42682;p=thirdparty%2Fasterisk.git res_pjsip_messaging: IPv6 receive address needs brackets When handling an incoming SIP MESSAGE, PJSIP attaches the IP address that the message was received from to the message in the variable PJSIP_RECVADDR. When the IP address is IPv6 the :PORT appended results in an unparseable mess. By using an additional bit flag on the pj_sockaddr_print call, the conventional use of brackets around the address is achieved. ASTERISK-27193 #close Change-Id: I12342521f2ce87a5b6e4883d480a3fd957aa9fd9 --- diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c index 8b465e0075..2f01a0f47d 100644 --- a/res/res_pjsip_messaging.c +++ b/res/res_pjsip_messaging.c @@ -512,7 +512,7 @@ static enum pjsip_status_code rx_data_to_ast_msg(pjsip_rx_data *rdata, struct as buf[size] = '\0'; res |= ast_msg_set_from(msg, "%s", buf); - field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf) - 1, 1); + field = pj_sockaddr_print(&rdata->pkt_info.src_addr, buf, sizeof(buf) - 1, 3); res |= ast_msg_set_var(msg, "PJSIP_RECVADDR", field); switch (rdata->tp_info.transport->key.type) {