소스 검색

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;
 			goto error;
 		}
-	}
-	else
-	{
+	} else {
 		u = &next_hop;
 		u->port_no = 5060;
 		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)
 		{
 			u->host.len = p - dest.s;