[svn-commits] mnicholson: trunk r318785 - in /trunk: ./ channels/sip/reqresp_parser.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 12 20:55:42 CDT 2011


Author: mnicholson
Date: Thu May 12 20:55:38 2011
New Revision: 318785

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318785
Log:
Merged revisions 318720 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r318720 | mnicholson | 2011-05-12 18:35:51 -0500 (Thu, 12 May 2011) | 4 lines
  
  Handle ipv6 addresses in the sent-by Via: field.
  
  This change fixes a regression in via header parsing and ipv6 handling.
........

Modified:
    trunk/   (props changed)
    trunk/channels/sip/reqresp_parser.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/reqresp_parser.c?view=diff&rev=318785&r1=318784&r2=318785
==============================================================================
--- trunk/channels/sip/reqresp_parser.c (original)
+++ trunk/channels/sip/reqresp_parser.c Thu May 12 20:55:38 2011
@@ -2302,8 +2302,9 @@
 	}
 	v->sent_by = ast_skip_blanks(v->sent_by);
 
-	/* store the port */
-	if ((parm = strchr(v->sent_by, ':'))) {
+	/* store the port, we have to handle ipv6 addresses containing ':'
+	 * characters gracefully */
+	if (((parm = strchr(v->sent_by, ']')) && *(++parm) == ':') || (parm = strchr(v->sent_by, ':'))) {
 		char *endptr;
 
 		v->port = strtol(++parm, &endptr, 10);
@@ -2389,6 +2390,13 @@
 		.expected_maddr = "224.0.0.1",
 		.expected_ttl = 1,
 	};
+	struct testdata t7 = {
+		.in = "SIP/2.0/UDP [::1]:5060",
+		.expected_protocol = "SIP/2.0/UDP",
+		.expected_sent_by = "[::1]:5060",
+		.expected_port = 5060,
+		.expected_branch = "",
+	};
 	switch (cmd) {
 	case TEST_INIT:
 		info->name = "parse_via_test";
@@ -2408,6 +2416,7 @@
 	AST_LIST_INSERT_TAIL(&testdatalist, &t4, list);
 	AST_LIST_INSERT_TAIL(&testdatalist, &t5, list);
 	AST_LIST_INSERT_TAIL(&testdatalist, &t6, list);
+	AST_LIST_INSERT_TAIL(&testdatalist, &t7, list);
 
 
 	AST_LIST_TRAVERSE(&testdatalist, testdataptr, list) {




More information about the svn-commits mailing list