From: Otto Moerbeek Date: Fri, 21 Jun 2024 08:05:42 +0000 (+0200) Subject: Remove potential double SOA records if the target of a dns64 name is NODATA X-Git-Tag: rec-5.2.0-alpha0~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40d632980b5734a08bd19015ee636ab5564e125a;p=thirdparty%2Fpdns.git Remove potential double SOA records if the target of a dns64 name is NODATA --- diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index 4f57be1f3b..2a121ce51a 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -785,6 +785,24 @@ int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector seenSOAs; + ret.erase(std::remove_if( + ret.begin(), + ret.end(), + [&seenSOAs](DNSRecord& record) { + if (record.d_type == QType::SOA) { + if (seenSOAs.count(record.d_name) > 0) { + // We've had this SOA before, remove it + return true; + } + seenSOAs.insert(record.d_name); + } + return false; + }), + ret.end()); + } t_Counters.at(rec::Counter::dns64prefixanswers)++; return rcode; }