瀏覽代碼

corex: detect ipv6 for send*() functions

Daniel-Constantin Mierla 10 年之前
父節點
當前提交
027495fb6a
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      modules/corex/corex_lib.c

+ 6 - 4
modules/corex/corex_lib.c

@@ -254,13 +254,15 @@ int corex_send(sip_msg_t *msg, gparam_t *pu, enum sip_protos proto)
 			ret=E_BUG;
 			ret=E_BUG;
 			goto error;
 			goto error;
 		}
 		}
-	}
-	else
-	{
+	} else {
 		u = &next_hop;
 		u = &next_hop;
 		u->port_no = 5060;
 		u->port_no = 5060;
 		u->host = dest;
 		u->host = dest;
-		p = memchr(dest.s, ':', dest.len);
+		p = dest.s;
+		/* detect ipv6 */
+		p = memchr(p, ']', dest.len);
+		if (p) p++;
+		p = memchr(p, ':', dest.len);
 		if (p)
 		if (p)
 		{
 		{
 			u->host.len = p - dest.s;
 			u->host.len = p - dest.s;