[Pdns-dev] dnsproxy code buffer size

Bauer, Steven J. Steve.Bauer at sdsmt.edu
Wed Apr 27 17:34:20 CEST 2011


After looking into the code that is used for proxying the dns requests to the recursor server, I was wondering what happens when the responses are larger than 1500 bytes?  Wouldn't this potentially cause issues when large data sets are passed back (DNSSEC data, etc.)?


void DNSProxy::mainloop(void)
{
  try {
    char buffer[1500];                       <--Buffer to small for large datasets
    int len;

    for(;;) {
      len=recv(d_sock, buffer, sizeof(buffer),0); // answer from our backend
      if(len<12) {
        if(len<0)
          L<<Logger::Error<<"Error receiving packet from recursor backend: "<<stringerror()<<endl;
        else if(len==0)
          L<<Logger::Error<<"Error receiving packet from recursor backend, EOF"<<endl;
        else
          L<<Logger::Error<<"Short packet from recursor backend, "<<len<<" bytes"<<endl;

        continue;
      }
      (*d_resanswers)++;
      (*d_udpanswers)++;


Also, digging into the class DNSPacket which  is used later on to store the data that has been sent back, there appears to be a limit of 1680 bytes.  (line 442 in DNSpacket.cc)

Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-dev/attachments/20110427/3059dc6a/attachment.html>


More information about the Pdns-dev mailing list