]> granicus.if.org Git - pdns/commitdiff
remove bashisms
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 20 Apr 2006 10:00:01 +0000 (10:00 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 20 Apr 2006 10:00:01 +0000 (10:00 +0000)
fix install on Solaris, FreeBSD
add fake ./configure script to catch Boost or lack thereof
update documentation

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

pdns/Makefile-recursor
pdns/README-recursor
pdns/configure-recursor [new file with mode: 0755]
pdns/dist-recursor
pdns/docs/pdns.sgml
pdns/lwres.cc
pdns/pdns-recursor.init.d
pdns/pdns_hw.cc [new file with mode: 0644]
pdns/syncres.cc
pdns/sysdeps-recursor/SunOS.inc

index ea7bc12e5ff99b5d4750da157e5a317704957443..0c3a7f9b1a2805bfb5f4afa0bd511dc6beeeb29b 100644 (file)
@@ -40,22 +40,35 @@ message:
        @echo PLEASE READ: for an easy fix!
        @echo 
 
+basic_checks: 
+       @-rm -f pdns_hw
+       -$(CXX) $(CXXFLAGS)  pdns_hw.cc -o pdns_hw 
+       @echo
+       @if test -x ./pdns_hw ; \
+                then if ./pdns_hw; then echo Everything ok, now run $(MAKE) using same settings \(if any\) you passed ./configure; else echo Could compile binary, but not run it, read README please ; fi; \
+        else   \
+               echo; echo Could not compile simple binary, read README please; \
+               rm -f dep ; \
+        fi
+
 install: all
-       -mkdirhier $(DESTDIR)/$(SBINDIR)
-       install -s pdns_recursor $(DESTDIR)/$(SBINDIR)
-       mkdirhier $(DESTDIR)/$(BINDIR)
-       install -s rec_control $(DESTDIR)/$(BINDIR)
-       -mkdirhier $(DESTDIR)/$(CONFIGDIR)
-       ./pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf
-       -mkdirhier $(DESTDIR)/usr/share/man/man1
+       -mkdir -p $(DESTDIR)/$(SBINDIR)
+       mv pdns_recursor $(DESTDIR)/$(SBINDIR)
+       strip $(DESTDIR)/$(SBINDIR)/pdns_recursor
+       mkdir -p $(DESTDIR)/$(BINDIR)
+       mv rec_control $(DESTDIR)/$(BINDIR)
+       strip $(DESTDIR)/$(BINDIR)/rec_control
+       -mkdir -p $(DESTDIR)/$(CONFIGDIR)
+       $(DESTDIR)/$(SBINDIR)/pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf
+       -mkdir -p $(DESTDIR)/usr/share/man/man1
        cp pdns_recursor.1 rec_control.1 $(DESTDIR)/usr/share/man/man1
        $(OS_SPECIFIC_INSTALL)  
 
 clean:
-       -rm -f *.o *~ pdns_recursor rec_control optional/*.o
+       -rm -f dep *.o *~ pdns_recursor rec_control optional/*.o
        
 dep:
-       $(CXX) $(CXXFLAGS) -MM *.cc *.hh > $@
+       $(CXX) $(CXXFLAGS) -MM -MG *.cc *.hh > $@
 
 -include dep
 
index d19e21b09ef7e8f618d895ceb78744df296bd57a..0a9fcc3f2f816eeb4a044749c00f2f7895493a99 100644 (file)
@@ -7,6 +7,9 @@ For full details, please read:
 COMPILING
 ---------
 
+$ ./configure
+$ make or gmake
+
 The only dependency is Boost, http://boost.org/
 You only need to download it, there is no need to compile.
 
@@ -25,10 +28,15 @@ $ tar xjf boost_1_33_1.tar.bz2
 
 3) Compile the PowerDNS recursor using:
 
-$ CXXFLAGS=-I./boost_1_33_1/ make
+$ CXXFLAGS=-I./boost_1_33_1/ ./configure
+$ CXXFLAGS=-I./boost_1_33_1/ make clean 
+$ CXXFLAGS=-I./boost_1_33_1/ make all
+(the 'clean' is needed to have make pick up the new boost)
 
 4) Run ./pdns_recursor and you should be set!
 
+5) (g)make install
+
 PERFORMANCE
 -----------
 
@@ -54,8 +62,6 @@ RUNNING ON A DIFFERENT MACHINE
 ------------------------------
 To prevent hassles with g++ 4.1 dependencies, you can build like this:
    $ STATIC=semi make all
-or even
-   $ STATIC=full make all
 
 PROBLEMS
 --------
diff --git a/pdns/configure-recursor b/pdns/configure-recursor
new file mode 100755 (executable)
index 0000000..d69172d
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+echo Testing dependencies and compiler.
+
+GMAKE=`which gmake`
+if test -z "$GMAKE"
+then
+       make basic_checks
+else
+       echo Using gmake to build
+       gmake basic_checks
+fi
+
index f5cce9121e28441ed87f845f49e3ed3be307563e..a98975718ed748c0fa210ff59352689fa86d81a2 100755 (executable)
@@ -10,7 +10,7 @@ CFILES="syncres.cc  misc.cc unix_utility.cc qtype.cc \
 logger.cc arguments.cc  lwres.cc pdns_recursor.cc  \
 recursor_cache.cc  dnsparser.cc dnswriter.cc  dnsrecords.cc  rcpgenerator.cc  \
 base64.cc  zoneparser-tng.cc  rec_channel.cc rec_channel_rec.cc rec_control.cc \
-selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc"
+selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc pdns_hw.cc"
 
 cd docs
 make pdns_recursor.1 rec_control.1
@@ -29,6 +29,7 @@ cp tools/rrd/{create,update,makegraphs,index.html} $DIRNAME/rrd
 cp ext/nedmalloc/malloc.c $DIRNAME
 cp pdns-recursor.init.d $DIRNAME
 cp docs/pdns_recursor.1 docs/rec_control.1 $DIRNAME
+cp configure-recursor $DIRNAME/configure
 
 mkdir -p $DIRNAME/sysdeps
 cp  sysdeps-recursor/* $DIRNAME/sysdeps
index 1b1e54a567cbe3c8c28a1fdebb26f1b89781253a..c803cbda220ba7d1ea5f5288e32c02236f5d27e1 100644 (file)
            </listitem>
            <listitem>
              <para>
-               delegation-only, a Verisign special. See <xref linkend="verisign">.
+               delegation-only, a Verisign special. 
              </para>
            </listitem>
            <listitem>
@@ -5960,7 +5960,7 @@ local0.err                        /var/log/pdns.err
            <term>delegation-only</term>
            <listitem>
              <para>
-               A Verisign special, see <xref linkend="verisign">.
+               A Verisign special.
              </para>
            </listitem>
          </varlistentry>
@@ -6124,21 +6124,22 @@ local0.err                        /var/log/pdns.err
          </varlistentry>
        </variablelist>
       <para>
-    <sect2 id="rec-control"><title>Controlling and querying the recursor</title>
-       <para>
-         To control and query the PowerDNS recursor, the tool <filename>rec_control</filename> is provided. This program
-         talks to the recursor over the 'controlsocket', often stored in <filename>/var/run</filename>.
-       </para>
-       <para>
-         As a sample command, try:
-         <screen>
-           # rec_control ping
-           pong
-         </screen>
-       </para>
-       <para>
-         When not running as root, <command>--socket-dir=/tmp</command> might be appropriate.
-       </para>
+    </sect1>
+    <sect1 id="rec-control"><title>Controlling and querying the recursor</title>
+      <para>
+       To control and query the PowerDNS recursor, the tool <filename>rec_control</filename> is provided. This program
+       talks to the recursor over the 'controlsocket', often stored in <filename>/var/run</filename>.
+      </para>
+      <para>
+       As a sample command, try:
+       <screen>
+         # rec_control ping
+         pong
+       </screen>
+      </para>
+      <para>
+       When not running as root, <command>--socket-dir=/tmp</command> might be appropriate.
+      </para>
        <para>
          All rec_control commands are documented below:
          <variablelist>
@@ -6212,34 +6213,41 @@ local0.err                        /var/log/pdns.err
        <para>
          More details on what 'throttled' queries and the like are can be found below in <xref linkend="recursor-details">.
        </para>
-      </sect2>
-
-    <sect2 id="verisign"><title>Verisign weirdness</title>
-       <para>
-         <note>
+    </sect1>
+    <sect1 id="recursor-performance"><title>PowerDNS Recursor performance</title>
+      <para>
+       To get the best out of the PowerDNS recursor, which is important if you are doing thousands of queries per second, please 
+       consider the following. 
+       <itemizedlist>
+         <listitem>
            <para>
-             Verisign backed off, this feature is no longer needed (for now).
+             Limit the size of the cache to a sensible value. Cache hit rate does not improve meaningfully beyond 4 million <command>max-cache-entries</command>,
+             reducing the memory footprint reduces CPU cache misses.
            </para>
-         </note>
-       </para>
-       <para>
-         Verisign, the current operator of the COM and NET zones, decided to add a wildcard record so as to draw all queries for non-existing 
-         domains to their own page, which lists domains you might want to visist instead. 
-       </para>
-       <para>
-         To reinstate old behaviour, add <command>delegation-only=com,net</command> to your recursor configuration.
-       </para>
-       <para>
-         What this does is reject all authoritative answers from the COM and NET servers. ISC, the current maintainers of BIND, have 
-         implemented this feature first, PowerDNS has mostly copied their algorithm. Thanks!
-       </para>
-       <para>
-         Verisign might decide to evade our tactic with wildcard NS records, by which time other measures will be needed to restore the 
-         old behaviour.
-       </para>
-      </sect2>
-         
-
+         </listitem>
+         <listitem>
+           <para>
+             Compile using g++ 4.1 or later. This compiler really does a good job on PowerDNS, much better than 3.4 or 4.0.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+             Consider performing a 'profiled build' as described in the README. This is good for a 20% performance boost in some cases.
+           </para>
+         </listitem>
+         <listitem>
+           <para>
+             When running with &gt;3000 queries per second, and running Linux versions prior to 2.6.17 on some motherboards, your computer may 
+             spend an inordinate amount of time working around an ACPI bug for each call to gettimeofday. This is solved by rebooting with 'clock=tsc'
+             or upgrading to a 2.6.17 kernel.
+           </para>
+           <para>
+             The above is relevant if dmesg shows <command>Using pmtmr for high-res timesource</command>
+           </para>
+         </listitem>
+       </itemizedlist>
+       Following the instructions above, you should be able to attain very high query rates.
+      </para>
     </sect1>
     <sect1 id="recursor-details"><title>Details</title>
       <para>
index 9669353610dc834eee97b7c8d4620492c09b58d7..f1248de29fa6c0131879b8e180f845e43e75efa0 100644 (file)
@@ -68,7 +68,6 @@ int LWRes::asyncresolve(uint32_t ip, const string& domain, int type, bool doTCP,
   d_inaxfr=false;
   d_rcode=0;
 
-
   struct sockaddr_in toaddr;
   Utility::socklen_t addrlen=sizeof(toaddr);
   toaddr.sin_addr.s_addr=htonl(ip);
index 31c93b83ee4910508da0faa6b90e1737085e7d43..59b99b2cdf7ba43e602da45ba9d3c387d4ca7f02 100755 (executable)
@@ -13,7 +13,7 @@ pdns_server=$SBINARYPATH/pdns_recursor
 
 doPC()
 {
-       ret=$($BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null)
+       ret=`$BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null`
 }
 
 
diff --git a/pdns/pdns_hw.cc b/pdns/pdns_hw.cc
new file mode 100644 (file)
index 0000000..0dfc4db
--- /dev/null
@@ -0,0 +1,19 @@
+#include <boost/lexical_cast.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/tuple/tuple_comparison.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+#include <sstream>
+
+using namespace std;
+int main()
+{
+       ostringstream str;
+       str << "Everything is ok!"<< boost::lexical_cast<string>("") <<"\n";
+       exit(0);
+}
index 52180b40b578125c3c2f168ba20171bee40b6b1b..d52c0e07b1656472df80b8f0b8ebc12fc58cb233 100644 (file)
@@ -120,6 +120,8 @@ int SyncRes::doResolve(const string &qname, const QType &qtype, vector<DNSResour
   if(d_cacheonly)
     return 0;
 
+  // place for lookaside cache
+
   LOG<<prefix<<qname<<": No cache hit for '"<<qname<<"|"<<qtype.getName()<<"', trying to find an appropriate NS record"<<endl;
 
   string subdomain(qname);
index 42cf8b0de38108b3f8fd85c231a5d4cd35927434..a43bfd0d2a3f00dc15c0dd33c5c21e8fd893e758 100644 (file)
@@ -1,4 +1,6 @@
+CC=gcc
 LDFLAGS+=-lresolv -lsocket -lnsl
+OS_SPECIFIC_INSTALL=mkdir -p $(DESTDIR)/etc/init.d ; cp pdns-recursor.init.d $(DESTDIR)/etc/init.d/pdns-recursor
 
 OPTIONALS:=optional/portsmplexer.o