Преглед изворни кода

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 пре 11 година
родитељ
комит
3aec75e97b
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7 1
      dns_cache.c

+ 7 - 1
dns_cache.c

@@ -3022,7 +3022,7 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 									struct ip_addr* ip,
 									int flags)
 {
-	int ret;
+	int ret, orig_ret;
 	str host;
 	struct dns_hash_entry* orig;
 
@@ -3050,10 +3050,13 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 		if (ret>=0) return ret;
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 			/* not found, try with AAAA */
+			orig_ret=ret;
 			orig=*e;
 			*e=0;
 			*rr_no=0;
 			ret=dns_aaaa_resolve(e, rr_no, &host, ip);
+			if (ret==-E_DNS_NO_IP && orig_ret==-E_DNS_EOR)
+				ret=orig_ret;
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 		}
@@ -3067,10 +3070,13 @@ inline static int dns_ip_resolve(	struct dns_hash_entry** e,
 		if (ret>=0) return ret;
 		if ((flags&DNS_IPV6_FIRST) && !(flags&DNS_IPV6_ONLY)){
 			/* not found, try with A */
+			orig_ret=ret;
 			orig=*e;
 			*e=0;
 			*rr_no=0;
 			ret=dns_a_resolve(e, rr_no, &host, ip);
+			if (ret==-E_DNS_NO_IP && orig_ret==-E_DNS_EOR)
+				ret=orig_ret;
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 		}