]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
update some copyrights, license version 2.0
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 10 Jul 2005 11:34:28 +0000 (11:34 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 10 Jul 2005 11:34:28 +0000 (11:34 +0000)
improve logging so TCP-queries can be spotted
added code to truncate overly long answers to 512 bytes and to set the TC bit
moved TCP writeout code to writev - somewhat more likely to work in face of tiny windows, more network efficient
removed duplicate 'it is advised to bind to non-0.0.0.0' etc message
updated tar-gz script to include generic oracle

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@435 d19b8d6e-7fed-0310-83ef-9ca221ded41b

build-scripts/tar-gz-build-instruction
pdns/dnspacket.cc
pdns/logger.cc
pdns/nameserver.cc
pdns/pdns_recursor.cc

index 5d6a7f56c616299dd1905e4556f895838226e45e..ffc826dac4a3fe32a38a7f97f050bae78235b819 100755 (executable)
@@ -1,6 +1,6 @@
 rm -f $(find . -name "*~") &&
 ./bootstrap && 
 ./configure \
---with-modules="mysql gmysql gpgsql xdb pipe oracle pipe pdns db2 odbc ldap gsqlite geo" \
+--with-modules="mysql gmysql gpgsql xdb pipe oracle pipe pdns db2 odbc ldap gsqlite geo goracle" \
 --with-dynmodules="" &&
 make dist 
\ No newline at end of file
index 2f547fae2a7cf416c29d50e09dfd3966b2b1f3df..977a1f40e238d1b34a5605e92d444dc18857586f 100644 (file)
@@ -3,7 +3,7 @@
     Copyright (C) 2005  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License versionm 2 as 
+    it under the terms of the GNU General Public License version 2 as 
     published by the Free Software Foundation
 
     This program is distributed in the hope that it will be useful,
index 9f51acec1f9bd3f0ac86e48517e3bc97456d8aee..8a9308a311d61995bab5beb17bff43f45884aa34 100644 (file)
@@ -46,7 +46,6 @@ void Logger::log(const string &msg, Urgency u)
     S.ringAccount("logmessages",msg);
     syslog(u,"%s",msg.c_str());
   }
-
 }
 
 void Logger::setLoglevel( Urgency u )
index 90725262d0a1fc276f29bc666b699244e95e8a0d..9297e6261b162af41c11074baa05a082e648262e 100644 (file)
@@ -1,10 +1,9 @@
 /*
-    Copyright (C) 2002  PowerDNS.COM BV
+    Copyright (C) 2002 - 2005  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+    it under the terms of the GNU General Public License version 2 as 
+    published by the Free Software Foundation.
 
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,7 +14,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
-// $Id$ 
+
 #include "utility.hh"
 #include <cstdio>
 #include <cstring>
@@ -197,7 +196,7 @@ void UDPNameserver::send(DNSPacket *p)
     p=new DNSPacket(*p);
     p->truncate(512);
     buffer=p->getData();
-    if(sendto(p->getSocket(),buffer,p->len,0,(struct sockaddr *)(p->remote),p->d_socklen)<0)
+    if(sendto(p->getSocket(),buffer,p->len,0,(struct sockaddr *)(p->remote),p->d_socklen)<0) 
       L<<Logger::Error<<"Error sending reply with sendto (socket="<<p->getSocket()<<"): "<<strerror(errno)<<endl;
     delete p;
   }
index 7c89a86d0111e68855b6b4f5fc6103e0092bbc33..4ea5312d48702f5122ad08d3e41eeb700c5c9013 100644 (file)
@@ -208,7 +208,7 @@ void primeHints(void)
 
     nsset.insert(nsrr);
   }
-  RC.replace("",QType(QType::NS),nsset);
+  RC.replace("",QType(QType::NS),nsset); // and stuff in the cache
 }
 
 void startDoResolve(void *p)
@@ -226,7 +226,7 @@ void startDoResolve(void *p)
 
     SyncRes sr;
     if(!quiet)
-      L<<Logger::Error<<"["<<MT->getTid()<<"] question for '"<<P.qdomain<<"|"<<P.qtype.getName()<<"' from "<<P.getRemote()<<endl;
+      L<<Logger::Error<<"["<<MT->getTid()<<"] " << (R->d_tcp ? "TCP " : "") << "question for '"<<P.qdomain<<"|"<<P.qtype.getName()<<"' from "<<P.getRemote()<<endl;
 
     sr.setId(MT->getTid());
     if(!P.d.rd)
@@ -243,14 +243,31 @@ void startDoResolve(void *p)
 
     const char *buffer=R->getData();
 
-    if(!R->d_tcp)
+    if(!R->d_tcp) {
+      if(R->len > 512) 
+       R->truncate(512);
+
       sendto(R->getSocket(),buffer,R->len,0,(struct sockaddr *)(R->remote),R->d_socklen);
+    }
     else {
       char buf[2];
       buf[0]=R->len/256;
       buf[1]=R->len%256;
-      if(write(R->getSocket(),buf,2)!=2 || write(R->getSocket(),buffer,R->len)!=R->len)
+
+      struct iovec iov[2];
+
+      iov[0].iov_base=(void*)buf;    iov[0].iov_len=2;
+      iov[1].iov_base=(void*)buffer; iov[1].iov_len = R->len;
+
+      int ret=writev(R->getSocket(), iov, 2);
+
+      if(ret <= 0 ) 
+       L<<Logger::Error<<"Error writing TCP answer to "<<P.getRemote()<<": "<< (ret ? strerror(errno) : "EOF") <<endl;
+      else if(ret != 2 + R->len)
        L<<Logger::Error<<"Oops, partial answer sent to "<<P.getRemote()<<" - probably would have trouble receiving our answer anyhow (size="<<R->len<<")"<<endl;
+
+      //      if(write(R->getSocket(),buf,2)!=2 || write(R->getSocket(),buffer,R->len)!=R->len)
+      //  XXX FIXME write this writev fallback otherwise
     }
 
     if(!quiet) {
@@ -309,10 +326,6 @@ void makeTCPServerSockets()
   if(locals.empty())
     throw AhuException("No local address specified");
   
-  if(arg()["local-address"]=="0.0.0.0") {
-    L<<Logger::Warning<<"It is advised to bind to explicit addresses with the --local-address option"<<endl;
-  }
-
   for(vector<string>::const_iterator i=locals.begin();i!=locals.end();++i) {
     int fd=socket(AF_INET, SOCK_STREAM,0);
     if(fd<0) 
@@ -636,7 +649,6 @@ int main(int argc, char **argv)
        }
       }
       
-
       for(vector<int>::const_iterator i=d_udpserversocks.begin(); i!=d_udpserversocks.end(); ++i) {
        if(FD_ISSET(*i,&readfds)) { // do we have a new question on udp?
          d_len=recvfrom(*i, data, sizeof(data), 0, (sockaddr *)&fromaddr, &addrlen);