Browse code

- minor check_self optimization

Andrei Pelinescu-Onciul authored on 21/08/2003 15:50:41
Showing 2 changed files
... ...
@@ -5,7 +5,7 @@ $Id$
5 5
 - change len_gt into and expr (e.g msg:len).
6 6
 - sipit: uri == myself doesn't match tls port = 5061
7 7
 - sipit: fix check_self & *_alias to work with tcp & tls
8
-- sipit: fix ipv6 references in check_self
8
+x sipit: fix ipv6 references in check_self
9 9
 - regex subst on uris?
10 10
 x port receive.c pre_script_cb fix from stable
11 11
 - extend alias to include port numbers :
... ...
@@ -266,14 +266,19 @@ int check_self(str* host, unsigned short port)
266 266
 				     sock_info[r].name.len)==0) /*slower*/)
267 267
 			/* comp. must be case insensitive, host names
268 268
 			 * can be written in mixed case, it will also match
269
-			 * ipv6 addresses */
269
+			 * ipv6 addresses if we are lucky*/
270 270
 			break;
271 271
 	/* check if host == ip address */
272 272
 #ifdef USE_IPV6
273 273
 		/* ipv6 case is uglier, host can be [3ffe::1] */
274 274
 		ip6=str2ip6(host);
275
-		if ((ip6) && ip_addr_cmp(ip6, &sock_info[r].address))
276
-			break; /* match */
275
+		if (ip6){
276
+			if (ip_addr_cmp(ip6, &sock_info[r].address))
277
+				break; /* match */
278
+			else
279
+				continue; /* no match, but this is an ipv6 address
280
+							 so no point in trying ipv4 */
281
+		}
277 282
 #endif
278 283
 		/* ipv4 */
279 284
 		if ( 	(!sock_info[r].is_ip) &&