Browse code

core: try to detect ipv6 addresses only when USE_IPV6 is used

- reported by Juha Heinanen
(cherry picked from commit b035aa9f2cc19d387b1b8f33a7888ffee27a4138)

Daniel-Constantin Mierla authored on 10/03/2013 22:53:26 • Juha Heinanen committed on 26/03/2013 08:45:19
Showing 1 changed files
... ...
@@ -1891,8 +1891,10 @@ inline static struct dns_hash_entry* dns_cache_do_request(str* name, int type)
1891 1891
 #endif /* USE_DNS_CACHE_STATS */
1892 1892
 
1893 1893
 	if (type==T_A){
1894
+#ifdef USE_IPV6
1894 1895
 		if (str2ip6(name)!=0)
1895 1896
 			goto end;
1897
+#endif /* USE_IPV6 */
1896 1898
 		if ((ip=str2ip(name))!=0){
1897 1899
 				e=dns_cache_mk_ip_entry(name, ip);
1898 1900
 				if (likely(e))
... ...
@@ -2469,8 +2471,10 @@ inline static struct hostent* dns_a_get_he(str* name)
2469 2471
 	struct hostent* he;
2470 2472
 
2471 2473
 	e=0;
2474
+#ifdef	USE_IPV6
2472 2475
 	if (str2ip6(name)!=0)
2473 2476
 		return 0;
2477
+#endif
2474 2478
 	if ((ip=str2ip(name))!=0){
2475 2479
 		return ip_addr2he(name, ip);
2476 2480
 	}
... ...
@@ -2971,8 +2975,10 @@ inline static int dns_a_resolve( struct dns_hash_entry** e,
2971 2975
 	ret=-E_DNS_NO_IP;
2972 2976
 	if (*e==0){ /* do lookup */
2973 2977
 		/* if ip don't set *e */
2978
+#ifdef	USE_IPV6
2974 2979
 		if (str2ip6(name)!=0)
2975 2980
 			goto error;
2981
+#endif
2976 2982
 		if ((tmp=str2ip(name))!=0){
2977 2983
 			*ip=*tmp;
2978 2984
 			*rr_no=0;