Browse code

core: Don't log errors when dns find no more records

If the proxy is listeneing on both ipv4 and ipv6, DNS attempts are done for
both A and AAAA records. If the last of these lookup fails with no records
found, don't log an error if the first lookup did already return records.

Alex Hermann authored on 30/10/2014 16:12:28
Showing 1 changed files
... ...
@@ -3022,7 +3022,7 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3022 3022
 									struct ip_addr* ip,
3023 3023
 									int flags)
3024 3024
 {
3025
-	int ret;
3025
+	int ret, orig_ret;
3026 3026
 	str host;
3027 3027
 	struct dns_hash_entry* orig;
3028 3028
 
... ...
@@ -3050,10 +3050,13 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3050 3050
 		if (ret>=0) return ret;
3051 3051
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
3052 3052
 			/* not found, try with AAAA */
3053
+			orig_ret=ret;
3053 3054
 			orig=*e;
3054 3055
 			*e=0;
3055 3056
 			*rr_no=0;
3056 3057
 			ret=dns_aaaa_resolve(e, rr_no, &host, ip);
3058
+			if (ret==-E_DNS_NO_IP && orig_ret==-E_DNS_EOR)
3059
+				ret=orig_ret;
3057 3060
 			/* delay original record release until we're finished with host*/
3058 3061
 			dns_hash_put(orig);
3059 3062
 		}
... ...
@@ -3067,10 +3070,13 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
3067 3067
 		if (ret>=0) return ret;
3068 3068
 		if ((flags&DNS_IPV6_FIRST) && !(flags&DNS_IPV6_ONLY)){
3069 3069
 			/* not found, try with A */
3070
+			orig_ret=ret;
3070 3071
 			orig=*e;
3071 3072
 			*e=0;
3072 3073
 			*rr_no=0;
3073 3074
 			ret=dns_a_resolve(e, rr_no, &host, ip);
3075
+			if (ret==-E_DNS_NO_IP && orig_ret==-E_DNS_EOR)
3076
+				ret=orig_ret;
3074 3077
 			/* delay original record release until we're finished with host*/
3075 3078
 			dns_hash_put(orig);
3076 3079
 		}