From: Sten Spans Date: Wed, 16 Nov 2022 21:46:21 +0000 (+0100) Subject: Allow multiple records with same name for etc/hosts processing X-Git-Tag: dnsdist-1.8.0-rc1~178^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a867410a2183e64d6abe212c5abcac7cf8a95b6b;p=thirdparty%2Fpdns.git Allow multiple records with same name for etc/hosts processing This seems to do something right at least --- diff --git a/pdns/reczones-helpers.cc b/pdns/reczones-helpers.cc index 8f613ac92f..daee88e6ff 100644 --- a/pdns/reczones-helpers.cc +++ b/pdns/reczones-helpers.cc @@ -75,17 +75,30 @@ static void makeNameToIPZone(SyncRes::domainmap_t& newMap, const ComboAddress& address, Logr::log_t log) { + SyncRes::AuthDomain ad; DNSRecord dr; + dr.d_name = hostname; - SyncRes::AuthDomain ad = makeSOAAndNSNodes(dr, "localhost."); + if (newMap.count(hostname) != 0) { + ad = newMap[hostname]; + } + else { + ad = makeSOAAndNSNodes(dr, "localhost."); + } auto recType = address.isIPv6() ? QType::AAAA : QType::A; dr.d_type = recType; + dr.d_ttl = 86400; dr.d_content = DNSRecordContent::mastermake(recType, 1, address.toStringNoInterface()); ad.d_records.insert(dr); - addToDomainMap(newMap, ad, dr.d_name, log); + if (newMap.count(hostname) != 0) { + newMap[ad.d_name] = ad; + } + else { + addToDomainMap(newMap, ad, dr.d_name, log); + } } static void makeIPToNamesZone(SyncRes::domainmap_t& newMap,