[Pdns-dev] Additional processing for SRV records
Christof Meerwald
cmeerw at web.de
Sat Oct 11 22:51:11 CEST 2003
Hi,
here is a patch to add additional processing for SRV records (see RFC 2782:
"... Implementors are urged, but not required, to return the address
record(s) in the Additional Data section. ..."
bye, Christof
--
http://cmeerw.org JID: cmeerw at jabber.at
mailto cmeerw at web.de
-------------- next part --------------
diff -ur pdns-2.9.12.orig/pdns/dnspacket.cc pdns-2.9.12/pdns/dnspacket.cc
--- pdns-2.9.12.orig/pdns/dnspacket.cc Thu Mar 27 11:40:40 2003
+++ pdns-2.9.12/pdns/dnspacket.cc Sat Oct 11 21:26:35 2003
@@ -896,7 +896,8 @@
{
if(i->d_place!=DNSResourceRecord::ADDITIONAL &&
( (i->qtype.getCode()==QType::NS && i->content.find('@')==string::npos) || // NS records with @ in them are processed
- i->qtype.getCode()==QType::MX ))
+ i->qtype.getCode()==QType::MX ||
+ i->qtype.getCode()==QType::SRV))
{
return true;
}
@@ -913,8 +914,9 @@
++i)
{
if(i->d_place!=DNSResourceRecord::ADDITIONAL &&
- (i->qtype.getCode()==15 ||
- i->qtype.getCode()==2 )) // CNAME or MX or NS
+ (i->qtype.getCode()==QType::MX ||
+ i->qtype.getCode()==QType::NS ||
+ i->qtype.getCode()==QType::SRV))
{
arrs.push_back(&*i);
}
diff -ur pdns-2.9.12.orig/pdns/packethandler.cc pdns-2.9.12/pdns/packethandler.cc
--- pdns-2.9.12.orig/pdns/packethandler.cc Tue Sep 16 23:02:35 2003
+++ pdns-2.9.12/pdns/packethandler.cc Sat Oct 11 21:21:38 2003
@@ -282,7 +282,18 @@
QType qtypes[2];
qtypes[0]="A"; qtypes[1]="AAAA";
for(int n=0;n < d_doIPv6AdditionalProcessing + 1; ++n) {
- B.lookup(qtypes[n],i->content,p);
+ if (i->qtype.getCode()==QType::SRV) {
+ vector<string>parts;
+ stringtok(parts,i->content);
+ if (parts.size() >= 3) {
+ B.lookup(qtypes[n],parts[2],p);
+ }
+ else
+ continue;
+ }
+ else {
+ B.lookup(qtypes[n],i->content,p);
+ }
bool foundOne=false;
while(B.get(rr)) {
foundOne=true;
More information about the Pdns-dev
mailing list