Changeset 1123
- Timestamp:
- 01/01/08 21:48:54 (2 years ago)
- Location:
- trunk/pdns/pdns
- Files:
-
- 3 modified
-
dnspacket.cc (modified) (5 diffs)
-
dnspacket.hh (modified) (2 diffs)
-
nameserver.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/dnspacket.cc
r1029 r1123 1 1 /* 2 2 PowerDNS Versatile Database Driven Nameserver 3 Copyright (C) 2001 - 200 7PowerDNS.COM BV3 Copyright (C) 2001 - 2008 PowerDNS.COM BV 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 88 88 qclass=orig.qclass; 89 89 qdomain=orig.qdomain; 90 90 d_maxreplylen = orig.d_maxreplylen; 91 91 rrs=orig.rrs; 92 92 … … 381 381 r->qdomain = qdomain; 382 382 r->qtype = qtype; 383 r->d_maxreplylen = d_maxreplylen; 383 384 return r; 384 385 } … … 407 408 return -1; 408 409 } 409 MOADNSParser mdp(string(mesg, length)); 410 MOADNSParser mdp(stringbuffer); 411 MOADNSParser::EDNSOpts edo; 412 if(mdp.getEDNSOpts(&edo)) { 413 d_maxreplylen=edo.d_packetsize; 414 } 415 else 416 d_maxreplylen=512; 410 417 411 418 memcpy((void *)&d,(const void *)stringbuffer.c_str(),12); … … 429 436 } 430 437 438 int DNSPacket::getMaxReplyLen() 439 { 440 return d_maxreplylen; 441 } 442 431 443 //! Use this to set where this packet was received from or should be sent to 432 444 void DNSPacket::setRemote(const ComboAddress *s) -
trunk/pdns/pdns/dnspacket.hh
r972 r1123 139 139 140 140 void commitD(); //!< copies 'd' into the stringbuffer 141 141 int getMaxReplyLen(); //!< retrieve the maximum length of the packet we should send in response 142 142 //////// DATA ! 143 143 … … 162 162 163 163 string stringbuffer; // this is where everything lives 4 164 164 int d_maxreplylen; 165 165 vector<DNSResourceRecord> rrs; // 4 166 166 }; -
trunk/pdns/pdns/nameserver.cc
r1080 r1123 43 43 44 44 \section copyright Copyright and License 45 PowerDNS is (C) 200 5PowerDNS.COM BV. It is distributed according to the terms of the General Public License version 2.45 PowerDNS is (C) 2001-2008 PowerDNS.COM BV. It is distributed according to the terms of the General Public License version 2. 46 46 47 47 \section overview High level overview … … 181 181 const char *buffer=p->getData(); 182 182 DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->remote.toString() <<" ("<<p->len<<" octets)"<<endl); 183 if(p->len >512) {183 if(p->len > p->getMaxReplyLen()) { 184 184 shared_ptr<DNSPacket> sharedp(new DNSPacket(*p)); 185 sharedp->truncate( 512);185 sharedp->truncate(p->getMaxReplyLen()); 186 186 buffer=sharedp->getData(); 187 187 if(sendto(sharedp->getSocket(),buffer,sharedp->len,0,(struct sockaddr *)(&sharedp->remote), sharedp->remote.getSocklen())<0)