Permalink
Browse files

no label compression for name in TSIG records

  • Loading branch information...
1 parent 15d6ffb commit 78fc378cfc84feb24e30e68b87e83695967d88cd @mind04 mind04 committed with mind04 Jul 20, 2013
Showing with 7 additions and 7 deletions.
  1. +1 −1 pdns/dnssecinfra.cc
  2. +5 −5 pdns/dnswriter.cc
  3. +1 −1 pdns/dnswriter.hh
View
@@ -529,7 +529,7 @@ void addTSIG(DNSPacketWriter& pw, TSIGRecordContent* trc, const string& tsigkeyn
trc->d_mac = calculateMD5HMAC(tsigsecret, toSign);
// d_trc->d_mac[0]++; // sabotage
- pw.startRecord(tsigkeyname, QType::TSIG, 0, 0xff, DNSPacketWriter::ADDITIONAL);
+ pw.startRecord(tsigkeyname, QType::TSIG, 0, 0xff, DNSPacketWriter::ADDITIONAL, false);
trc->toPacket(pw);
pw.commit();
}
View
@@ -53,7 +53,7 @@ dnsheader* DNSPacketWriter::getHeader()
return (dnsheader*)&*d_content.begin();
}
-void DNSPacketWriter::startRecord(const string& name, uint16_t qtype, uint32_t ttl, uint16_t qclass, Place place)
+void DNSPacketWriter::startRecord(const string& name, uint16_t qtype, uint32_t ttl, uint16_t qclass, Place place, bool compress)
{
if(!d_record.empty())
commit();
@@ -64,19 +64,19 @@ void DNSPacketWriter::startRecord(const string& name, uint16_t qtype, uint32_t t
d_recordttl=ttl;
d_recordplace=place;
- d_stuff = 0;
+ d_stuff = 0;
d_rollbackmarker=d_content.size();
- if(pdns_iequals(d_qname, d_recordqname)) { // don't do the whole label compression thing if we *know* we can get away with "see question"
+ if(compress && pdns_iequals(d_qname, d_recordqname)) { // don't do the whole label compression thing if we *know* we can get away with "see question"
static unsigned char marker[2]={0xc0, 0x0c};
d_content.insert(d_content.end(), (const char *) &marker[0], (const char *) &marker[2]);
}
else {
- xfrLabel(d_recordqname, true);
+ xfrLabel(d_recordqname, compress);
d_content.insert(d_content.end(), d_record.begin(), d_record.end());
d_record.clear();
}
-
+
d_stuff = sizeof(dnsrecordheader); // this is needed to get compressed label offsets right, the dnsrecordheader will be interspersed
d_sor=d_content.size() + d_stuff; // start of real record
}
View
@@ -50,7 +50,7 @@ public:
/** Start a new DNS record within this packet for namq, qtype, ttl, class and in the requested place. Note that packets can only be written in natural order -
ANSWER, AUTHORITY, ADDITIONAL */
- void startRecord(const string& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=1, Place place=ANSWER);
+ void startRecord(const string& name, uint16_t qtype, uint32_t ttl=3600, uint16_t qclass=1, Place place=ANSWER, bool compress=true);
/** Shorthand way to add an Opt-record, for example for EDNS0 purposes */
typedef vector<pair<uint16_t,std::string> > optvect_t;

0 comments on commit 78fc378

Please sign in to comment.