Selaa lähdekoodia

- minor check_self optimization

Andrei Pelinescu-Onciul 22 vuotta sitten
vanhempi
commit
880c030d92
2 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 1 1
      TODO
  2. 8 3
      forward.c

+ 1 - 1
TODO

@@ -5,7 +5,7 @@ $Id$
 - change len_gt into and expr (e.g msg:len).
 - sipit: uri == myself doesn't match tls port = 5061
 - sipit: fix check_self & *_alias to work with tcp & tls
-- sipit: fix ipv6 references in check_self
+x sipit: fix ipv6 references in check_self
 - regex subst on uris?
 x port receive.c pre_script_cb fix from stable
 - extend alias to include port numbers :

+ 8 - 3
forward.c

@@ -266,14 +266,19 @@ int check_self(str* host, unsigned short port)
 				     sock_info[r].name.len)==0) /*slower*/)
 			/* comp. must be case insensitive, host names
 			 * can be written in mixed case, it will also match
-			 * ipv6 addresses */
+			 * ipv6 addresses if we are lucky*/
 			break;
 	/* check if host == ip address */
 #ifdef USE_IPV6
 		/* ipv6 case is uglier, host can be [3ffe::1] */
 		ip6=str2ip6(host);
-		if ((ip6) && ip_addr_cmp(ip6, &sock_info[r].address))
-			break; /* match */
+		if (ip6){
+			if (ip_addr_cmp(ip6, &sock_info[r].address))
+				break; /* match */
+			else
+				continue; /* no match, but this is an ipv6 address
+							 so no point in trying ipv4 */
+		}
 #endif
 		/* ipv4 */
 		if ( 	(!sock_info[r].is_ip) &&