}
if (ret.size()) {
- pdns::orderAndShuffle(ret);
+ pdns::orderAndShuffle(ret, false);
if (auto sl = luaconfsLocal->sortlist.getOrderCmp(dc->d_source)) {
stable_sort(ret.begin(), ret.end(), *sl);
variableAnswer = true;
{"CacheOnly", AdditionalMode::CacheOnly},
{"CacheOnlyRequireAuth", AdditionalMode::CacheOnlyRequireAuth},
{"ResolveImmediately", AdditionalMode::ResolveImmediately},
- {"ResolveDeferred", AdditionalMode::ResolveDeferred}
- };
+ {"ResolveDeferred", AdditionalMode::ResolveDeferred}};
if (modeMap.find(it->second) == modeMap.end()) {
g_log << Logger::Error << "addAllowedAdditionalQType: unknown mode " << it->second << endl;
return;
}
// shuffle, maintaining some semblance of order
-static void shuffle(std::vector<DNSRecord>& rrs)
+static void shuffle(std::vector<DNSRecord>& rrs, bool includingAdditionals)
{
// This shuffles in the same style as the above method, keeping CNAME in the front and RRSIGs at the end
std::vector<DNSRecord>::iterator first, second;
shuffle(first, second, r);
}
+ if (!includingAdditionals) {
+ return;
+ }
+
// now shuffle the additional records
for (first = second; first != rrs.end(); ++first) {
if (first->d_place == DNSResourceRecord::ADDITIONAL && first->d_type != QType::CNAME) {
// make sure rrs is sorted in d_place order to avoid surprises later
// then shuffle the parts that desire shuffling
-void pdns::orderAndShuffle(vector<DNSRecord>& rrs)
+void pdns::orderAndShuffle(vector<DNSRecord>& rrs, bool includingAdditionals)
{
std::stable_sort(rrs.begin(), rrs.end(), [](const DNSRecord& a, const DNSRecord& b) {
return std::make_tuple(a.d_place, mapTypesToOrder(a.d_type)) < std::make_tuple(b.d_place, mapTypesToOrder(b.d_type));
});
- shuffle(rrs);
+ shuffle(rrs, includingAdditionals);
}