Browse code

corex: detect ipv6 for send*() functions

(cherry picked from commit 027495fb6ac7c8f50ff9945c209bc9f7ac98d991)
(cherry picked from commit 4fdd11699c83f2e4c787d210ca08eb3ec2fb559a)
(cherry picked from commit 5b93cc210c8608f6c030dd889d66f8deee43bf54)

Daniel-Constantin Mierla authored on 21/10/2015 07:49:38
Showing 1 changed files
... ...
@@ -250,13 +250,15 @@ int corex_send(sip_msg_t *msg, gparam_t *pu, enum sip_protos proto)
250 250
 			ret=E_BUG;
251 251
 			goto error;
252 252
 		}
253
-	}
254
-	else
255
-	{
253
+	} else {
256 254
 		u = &next_hop;
257 255
 		u->port_no = 5060;
258 256
 		u->host = dest;
259
-		p = memchr(dest.s, ':', dest.len);
257
+		p = dest.s;
258
+		/* detect ipv6 */
259
+		p = memchr(p, ']', dest.len);
260
+		if (p) p++;
261
+		p = memchr(p, ':', dest.len);
260 262
 		if (p)
261 263
 		{
262 264
 			u->host.len = p - dest.s;