From: Bert Hubert Date: Sun, 10 Jul 2005 11:34:28 +0000 (+0000) Subject: update some copyrights, license version 2.0 X-Git-Tag: pdns-2.9.18~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feccc9fc0c93743efe34e5987d1e69c66c637feb;p=thirdparty%2Fpdns.git update some copyrights, license version 2.0 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 --- diff --git a/build-scripts/tar-gz-build-instruction b/build-scripts/tar-gz-build-instruction index 5d6a7f56c6..ffc826dac4 100755 --- a/build-scripts/tar-gz-build-instruction +++ b/build-scripts/tar-gz-build-instruction @@ -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 diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index 2f547fae2a..977a1f40e2 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -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, diff --git a/pdns/logger.cc b/pdns/logger.cc index 9f51acec1f..8a9308a311 100644 --- a/pdns/logger.cc +++ b/pdns/logger.cc @@ -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 ) diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 90725262d0..9297e6261b 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -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 #include @@ -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<getTid()<<"] question for '"<getTid()<<"] " << (R->d_tcp ? "TCP " : "") << "question for '"<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<len) L<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<::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::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);