Răsfoiți Sursa

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 ani în urmă
părinte
comite
3aec75e97b
1 a modificat fișierele cu 7 adăugiri și 1 ștergeri
  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,
 									struct ip_addr* ip,
 									int flags)
 									int flags)
 {
 {
-	int ret;
+	int ret, orig_ret;
 	str host;
 	str host;
 	struct dns_hash_entry* orig;
 	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 (ret>=0) return ret;
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 		if (!(flags&(DNS_IPV6_ONLY|DNS_IPV6_FIRST|DNS_IPV4_ONLY))){
 			/* not found, try with AAAA */
 			/* not found, try with AAAA */
+			orig_ret=ret;
 			orig=*e;
 			orig=*e;
 			*e=0;
 			*e=0;
 			*rr_no=0;
 			*rr_no=0;
 			ret=dns_aaaa_resolve(e, rr_no, &host, ip);
 			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*/
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 			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 (ret>=0) return ret;
 		if ((flags&DNS_IPV6_FIRST) && !(flags&DNS_IPV6_ONLY)){
 		if ((flags&DNS_IPV6_FIRST) && !(flags&DNS_IPV6_ONLY)){
 			/* not found, try with A */
 			/* not found, try with A */
+			orig_ret=ret;
 			orig=*e;
 			orig=*e;
 			*e=0;
 			*e=0;
 			*rr_no=0;
 			*rr_no=0;
 			ret=dns_a_resolve(e, rr_no, &host, ip);
 			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*/
 			/* delay original record release until we're finished with host*/
 			dns_hash_put(orig);
 			dns_hash_put(orig);
 		}
 		}