Browse Source

Fix: failure of cache expired DNS record querying over DoQ

秋のかえで 3 years ago
parent
commit
b76b10b529
1 changed files with 7 additions and 11 deletions
  1. 7 11
      app/dns/nameserver_quic.go

+ 7 - 11
app/dns/nameserver_quic.go

@@ -232,20 +232,20 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
 
 
 	var ips []net.Address
 	var ips []net.Address
 	var lastErr error
 	var lastErr error
-	if option.IPv6Enable && record.AAAA != nil && record.AAAA.RCode == dnsmessage.RCodeSuccess {
-		aaaa, err := record.AAAA.getIPs()
+	if option.IPv4Enable {
+		a, err := record.A.getIPs()
 		if err != nil {
 		if err != nil {
 			lastErr = err
 			lastErr = err
 		}
 		}
-		ips = append(ips, aaaa...)
+		ips = append(ips, a...)
 	}
 	}
 
 
-	if option.IPv4Enable && record.A != nil && record.A.RCode == dnsmessage.RCodeSuccess {
-		a, err := record.A.getIPs()
+	if option.IPv6Enable {
+		aaaa, err := record.AAAA.getIPs()
 		if err != nil {
 		if err != nil {
 			lastErr = err
 			lastErr = err
 		}
 		}
-		ips = append(ips, a...)
+		ips = append(ips, aaaa...)
 	}
 	}
 
 
 	if len(ips) > 0 {
 	if len(ips) > 0 {
@@ -256,11 +256,7 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp
 		return nil, lastErr
 		return nil, lastErr
 	}
 	}
 
 
-	if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) {
-		return nil, dns_feature.ErrEmptyResponse
-	}
-
-	return nil, errRecordNotFound
+	return nil, dns_feature.ErrEmptyResponse
 }
 }
 
 
 // QueryIP is called from dns.Server->queryIPTimeout
 // QueryIP is called from dns.Server->queryIPTimeout