Skip to content

Commit d98da9f

Browse files
authored
Merge pull request #16968 from rgacogne/ddist-fix-compression-dname-srv
dnsdist: Fix the use of compression for SRV and DNAME targets
2 parents 443f894 + cea0cc1 commit d98da9f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

pdns/dnsdistdist/dnsdist-dnsparser.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ bool changeNameInDNSPacket(PacketBuffer& initialPacket, const DNSName& from, con
132132
pw.startRecord(rrname, ah.d_type, ah.d_ttl, ah.d_class, place, true);
133133
if (nameOnlyTypes.count(ah.d_type)) {
134134
rrname = pr.getName();
135-
pw.xfrName(rrname, true);
135+
// compression is not allowed for DNAME target per rfc6672 section 2.5
136+
pw.xfrName(rrname, ah.d_type != QType::DNAME);
136137
}
137138
else if (noNameTypes.count(ah.d_type)) {
138139
pr.xfrBlob(blob);
@@ -173,7 +174,11 @@ bool changeNameInDNSPacket(PacketBuffer& initialPacket, const DNSName& from, con
173174
/* port */
174175
pw.xfr16BitInt(pr.get16BitInt());
175176
auto target = pr.getName();
176-
pw.xfrName(target, true);
177+
/* Compression is not allowed per rfc2782:
178+
"Unless and until permitted by future standards action,
179+
name compression is not to be used for this field."
180+
*/
181+
pw.xfrName(target, false);
177182
}
178183
else {
179184
/* sorry, unsafe type */

0 commit comments

Comments
 (0)