]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix the use of compression for SRV and DNAME targets 16968/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 10 Mar 2026 14:12:36 +0000 (15:12 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 10 Mar 2026 14:12:36 +0000 (15:12 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-dnsparser.cc

index e7203561460c8d0fa2f6368f41665a9bfb064852..8d97b0777475e753cd756fb655015516a6eb0422 100644 (file)
@@ -132,7 +132,8 @@ bool changeNameInDNSPacket(PacketBuffer& initialPacket, const DNSName& from, con
     pw.startRecord(rrname, ah.d_type, ah.d_ttl, ah.d_class, place, true);
     if (nameOnlyTypes.count(ah.d_type)) {
       rrname = pr.getName();
-      pw.xfrName(rrname, true);
+      // compression is not allowed for DNAME target per rfc6672 section 2.5
+      pw.xfrName(rrname, ah.d_type != QType::DNAME);
     }
     else if (noNameTypes.count(ah.d_type)) {
       pr.xfrBlob(blob);
@@ -173,7 +174,11 @@ bool changeNameInDNSPacket(PacketBuffer& initialPacket, const DNSName& from, con
       /* port */
       pw.xfr16BitInt(pr.get16BitInt());
       auto target = pr.getName();
-      pw.xfrName(target, true);
+      /* Compression is not allowed per rfc2782:
+         "Unless and until permitted by future standards action,
+         name compression is not to be used for this field."
+      */
+      pw.xfrName(target, false);
     }
     else {
       /* sorry, unsafe type */