~ubuntu-branches/ubuntu/trusty/pdns/trusty-backports

« back to all changes in this revision

Viewing changes to pdns/nameserver.cc

  • Committer: Package Import Robot
  • Author(s): Matthijs Möhlmann
  • Date: 2011-11-19 11:58:10 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20111119115810-5u926cmriehkt5j7
Tags: 3.0-1
* New upstream version (Closes: #624330, #626909, #617476, #498918, #500572)
  (Closes: #645539, #623036, #521791, #583161, #590285, #499396)
* Update Standards-Version to 3.9.2
* Add lua backend.
* Use new style dh instead of individual dh_* commands.
* Add Homepage to debian/control (Closes: #634947)
* Add pdnssec and dnsreplay utility.
* Use dbconfig-common to populate / upgrade databases.
* Update patch addconfigdir, do not parse ucf-dist files.
* Update manpage pdns_control and include a list of options (Closes: #621724)
* Add manpage for pdnssec.
* Add prerm scripts to the backends, stop the pdns server.
* Add patch from upstream to properly parse priority. (Closes: #533023)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "arguments.hh"
34
34
#include "statbag.hh"
35
35
 
36
 
using namespace boost;
 
36
#include "namespaces.hh"
37
37
 
38
38
extern StatBag S;
39
39
 
156
156
    }
157
157
    d_highfd=max(s,d_highfd);
158
158
    d_sockets.push_back(s);
159
 
    L<<Logger::Error<<"UDPv6 server bound to ["<<localname<<"]:"<<::arg().asNum("local-port")<<endl;
 
159
    L<<Logger::Error<<"UDPv6 server bound to "<<locala.toStringWithPort()<<endl;
160
160
    FD_SET(s, &d_rfds);
161
161
  }
162
162
#endif // WIN32
178
178
 
179
179
void UDPNameserver::send(DNSPacket *p)
180
180
{
181
 
  const char *buffer=p->getData();
182
 
  DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->remote.toString() <<" ("<<p->len<<" octets)"<<endl);
183
 
  if(p->len > p->getMaxReplyLen()) {
184
 
    shared_ptr<DNSPacket> sharedp(new DNSPacket(*p));
185
 
    sharedp->truncate(p->getMaxReplyLen());
186
 
    buffer=sharedp->getData();
187
 
    if(sendto(sharedp->getSocket(),buffer,sharedp->len,0,(struct sockaddr *)(&sharedp->remote), sharedp->remote.getSocklen())<0) 
188
 
      L<<Logger::Error<<"Error sending reply with sendto (socket="<<sharedp->getSocket()<<"): "<<strerror(errno)<<endl;
189
 
  }
190
 
  else {
191
 
    if(sendto(p->getSocket(),buffer,p->len,0,(struct sockaddr *)(&p->remote),p->remote.getSocklen())<0)
192
 
      L<<Logger::Error<<"Error sending reply with sendto (socket="<<p->getSocket()<<"): "<<strerror(errno)<<endl;
193
 
  }
 
181
  const string& buffer=p->getString();
 
182
  DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->remote.toString() <<" ("<< buffer.length()<<" octets)"<<endl);
 
183
  if(buffer.length() > p->getMaxReplyLen()) {
 
184
    cerr<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p->getMaxReplyLen()<<endl;
 
185
  }
 
186
  if(sendto(p->getSocket(),buffer.c_str(), buffer.length(), 0, (struct sockaddr *)(&p->d_remote), p->d_remote.getSocklen()) < 0)
 
187
    L<<Logger::Error<<"Error sending reply with sendto (socket="<<p->getSocket()<<"): "<<strerror(errno)<<endl;
194
188
}
195
189