]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
If EDNS is mandatory, do it always in the first iteration (#YWH-PGM6095-290) 17594/head rec-5.3.8
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 May 2026 08:09:13 +0000 (10:09 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 8 Jun 2026 09:55:54 +0000 (11:55 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/syncres.cc

index 430e3401889f6deccef4a479f818c1901c7cd38d..c9182c73b678506e59566a11866451472dfd8460 100644 (file)
@@ -1483,13 +1483,16 @@ LWResult::Result SyncRes::asyncresolveWrapper(const ComboAddress& address, bool
 
   for (int tries = 0; tries < 2; ++tries) {
 
-    if (mode == EDNSStatus::NOEDNS) {
+    // We might have recorded (due to transient or spoofing issues) the target as not supporting
+    // EDNS. But if we plan to do DNSSEC validation, actually force EDNS for the first try so DNSSEC
+    // has a chance.
+    if ((tries == 0 && ednsMANDATORY) || mode != EDNSStatus::NOEDNS) {
+      EDNSLevel = 1;
+    }
+    else {
       t_Counters.at(rec::Counter::noEdnsOutQueries)++;
       EDNSLevel = 0; // level != mode
     }
-    else if (ednsMANDATORY || mode != EDNSStatus::NOEDNS) {
-      EDNSLevel = 1;
-    }
 
     DNSName sendQname(domain);
     if (g_lowercaseOutgoing) {