diff --git a/app/dns/nameserver_doh.go b/app/dns/nameserver_doh.go index db61e831a40..ec86884a1d9 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -325,6 +325,10 @@ func (s *DoHNameServer) findIPsForDomain(domain string, option dns_feature.IPOpt return nil, err6 } + if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) { + return nil, dns_feature.ErrEmptyResponse + } + return nil, errRecordNotFound } diff --git a/app/dns/nameserver_quic.go b/app/dns/nameserver_quic.go index b0618ecee40..565da06ef5b 100644 --- a/app/dns/nameserver_quic.go +++ b/app/dns/nameserver_quic.go @@ -262,6 +262,10 @@ func (s *QUICNameServer) findIPsForDomain(domain string, option dns_feature.IPOp return nil, err6 } + if (option.IPv4Enable && record.A != nil) || (option.IPv6Enable && record.AAAA != nil) { + return nil, dns_feature.ErrEmptyResponse + } + return nil, errRecordNotFound }