From fc634e87524d8f911f252b7365344e60a7800b34 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 1 Jun 2015 16:27:10 +0200 Subject: [PATCH] this commit DISABLES LABEL COMPRESSION. tinydns works, few test failures, mostly explained by lack of compression or case (in)sensitivity issues --- modules/tinydnsbackend/tinydnsbackend.cc | 8 ++++---- pdns/dnslabeltext.rl | 4 ++-- pdns/dnspacket.cc | 4 +++- pdns/dnswriter.cc | 25 ++++++++++++++---------- pdns/dnswriter.hh | 2 +- pdns/packethandler.cc | 1 + 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/modules/tinydnsbackend/tinydnsbackend.cc b/modules/tinydnsbackend/tinydnsbackend.cc index 642e1a240..6837437a1 100644 --- a/modules/tinydnsbackend/tinydnsbackend.cc +++ b/modules/tinydnsbackend/tinydnsbackend.cc @@ -157,7 +157,7 @@ void TinyDNSBackend::getAllDomains(vector *domains, bool include_dis bool TinyDNSBackend::list(const DNSName &target, int domain_id, bool include_disabled) { d_isAxfr=true; - string key = simpleCompress(target.toString()); // FIXME bug: no lowercase here? or do we promise lowercase from core now? + string key = target.toDNSString(); // FIXME bug: no lowercase here? or promise that from core? d_cdbReader=new CDB(getArg("dbfile")); return d_cdbReader->searchSuffix(key); } @@ -252,8 +252,8 @@ bool TinyDNSBackend::get(DNSResourceRecord &rr) key.insert(0, 1, '\052'); key.insert(0, 1, '\001'); } - rr.qname.clear(); - rr.qname=key; + // rr.qname.clear(); + rr.qname=DNSName(key.c_str(), key.size(), 0, false); rr.domain_id=-1; // 11:13.21 <@ahu> IT IS ALWAYS AUTH --- well not really because we are just a backend :-) // We could actually do NSEC3-NARROW DNSSEC according to Habbie, if we do, we need to change something ehre. @@ -282,7 +282,7 @@ bool TinyDNSBackend::get(DNSResourceRecord &rr) DNSRecordContent *drc = DNSRecordContent::mastermake(dr, pr); rr.content = drc->getZoneRepresentation(); - // cerr<<"CONTENT: "<& ret, string& segment, char c) vector segmentDNSText(const string& input ) { - cerr<<"segmentDNSText("< segmentDNSText(const string& input ) deque segmentDNSName(const string& input ) { - cerr<<"segmentDNSName("<::const_iterator i=d_rrs.begin();i!=d_rrs.end();++i) if(rr.qname==i->qname && rr.qtype==i->qtype && rr.content==i->content) { return; } - + cerr<<"added to d_rrs"<content<<"]"<scopeMask); if(!pos->content.empty() && pos->qtype.getCode()==QType::TXT && pos->content[0]!='"') { diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index eef1c993c..13f4c56e2 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -200,8 +200,10 @@ void DNSPacketWriter::xfrName(const DNSName& name, bool compress) { // string label = d_lowerCase ? toLower(Label) : Label; // FIXME: we ignore d_lowerCase for now + cerr<<"xfrName writing ["< parts = name.getRawLabels(); // labelparts_t parts; + cerr<<"labelcount: "<first, labellen - i->first -1); // else @@ -229,16 +232,17 @@ void DNSPacketWriter::xfrName(const DNSName& name, bool compress) lmap_t::iterator li=d_labelmap.end(); // see if we've written out this domain before // cerr<<"Searching for compression pointer to '"<second< 253) // chopped does not include a length octet for the first label and the root label - throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name"); - uint16_t offset=li->second; - offset|=0xc000; - d_record.push_back((char)(offset >> 8)); - d_record.push_back((char)(offset & 0xff)); - goto out; // skip trailing 0 in case of compression - } + // if(compress && (li=find(d_labelmap, label))!=d_labelmap.end()) { + // cerr<<"doing compression, my label=["<first<<"]"<second< 253) // chopped does not include a length octet for the first label and the root label + // throw MOADNSException("DNSPacketWriter::xfrName() found overly large (compressed) name"); + // uint16_t offset=li->second; + // offset|=0xc000; + // d_record.push_back((char)(offset >> 8)); + // d_record.push_back((char)(offset & 0xff)); + // goto out; // skip trailing 0 in case of compression + // } if(li==d_labelmap.end() && pos< 16384) { // cerr<<"\tStoring a compression pointer to '"< > optvect_t; diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 549f4f026..09781f170 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1245,6 +1245,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) weDone = weRedirected = weHaveUnauth = false; while(B.get(rr)) { + cerr<<"got content: ["<qtype.getCode() == QType::ANY && !p->d_dnssecOk && (rr.qtype.getCode() == QType:: DNSKEY || rr.qtype.getCode() == QType::NSEC3PARAM)) continue; // Don't send dnssec info to non validating resolvers. if (rr.qtype.getCode() == QType::RRSIG) // RRSIGS are added later any way. -- 2.40.0