[Asterisk-code-review] chan sip: Fix port parsing for IPv6 addresses in SIP Via hea... (asterisk[11])

Florian Sauerteig asteriskteam at digium.com
Tue Oct 6 12:45:05 CDT 2015


Florian Sauerteig has uploaded a new change for review.

  https://gerrit.asterisk.org/1391

Change subject: chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.
......................................................................

chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.

If a Via header containes an IPv6 address and a port number is ommitted,
as it is the standard port, we now leave the port empty and to not set it
to the value after the first colon of the IPv6 address.

ASTERISK-25443

Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70
---
M channels/sip/reqresp_parser.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/1391/1

diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c
index 42bb04d..9b435d0 100644
--- a/channels/sip/reqresp_parser.c
+++ b/channels/sip/reqresp_parser.c
@@ -2323,7 +2323,7 @@
 
 	/* store the port, we have to handle ipv6 addresses containing ':'
 	 * characters gracefully */
-	if (((parm = strchr(v->sent_by, ']')) && *(++parm) == ':') || (parm = strchr(v->sent_by, ':'))) {
+	if (((parm = strchr(v->sent_by, ']')) && *(++parm) == ':') || (!(parm = strchr(v->sent_by, ']')) && (parm = strchr(v->sent_by, ':')))) {
 		char *endptr;
 
 		v->port = strtol(++parm, &endptr, 10);

-- 
To view, visit https://gerrit.asterisk.org/1391
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Florian Sauerteig <ffs at ccn.net>



More information about the asterisk-code-review mailing list