]> granicus.if.org Git - pdns/commitdiff
Don't try to parse non-query opcode packets, by Jan Gyselinck
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 13 Aug 2006 12:58:57 +0000 (12:58 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 13 Aug 2006 12:58:57 +0000 (12:58 +0000)
add logging-facility (and document it)

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

pdns/dnsparser.cc
pdns/docs/pdns.sgml
pdns/pdns_recursor.cc

index fcd82c474a75b072c5461ceaa538abe8e62d87f8..996bf04ea91b2f29b789e44de5d38e385e549fb1 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2005  PowerDNS.COM BV
+    Copyright (C) 2005 - 2006  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 version 2 as 
@@ -178,6 +178,9 @@ void MOADNSParser::init(const char *packet, unsigned int len)
   
   memcpy(&d_header, packet, sizeof(dnsheader));
 
+  if(d_header.opcode)
+    throw MOADNSException("Can't parse non-query packet with opcode="+ lexical_cast<string>(d_header.opcode));
+
   d_header.qdcount=ntohs(d_header.qdcount);
   d_header.ancount=ntohs(d_header.ancount);
   d_header.nscount=ntohs(d_header.nscount);
index 2c157e381d3997b02249a93f6c7bd9127953709b..97fb5c272fbaae63d57863927c81268c463a66f0 100644 (file)
        Before proceeding, it is advised to check the release notes for your PDNS version, as specified in the name of the distribution
        file.
       </para>
-      <sect2 id="changelog-recursor-3-1-2"><title>Recursor version 3.1.2 (unreleased)</title>
+      <sect2 id="changelog-recursor-3-1-2"><title>Recursor version 3.1.2</title>
+       <para>
+         Released Monday 26th of June 2006.
+       </para>
        <para>
          Compared to 3.1.1, this release consists almost exclusively of bug-fixes and speedups. A quick update is recommended, as some of the bugs
          impact operators of authoritative zones on the internet. This version has been tested by some of the largest internet providers on the planet,
@@ -6483,6 +6486,16 @@ local0.err                        /var/log/pdns.err
              </para>
            </listitem>
          </varlistentry>
+         <varlistentry>
+           <term>logging-facility</term>
+           <listitem>
+             <para>
+               If set to a digit, logging is performed under this LOCAL facility. See <xref linkend="syslog"/>. Available from 3.1.3 and onwards. Do not pass names like 'local0'!
+             </para>
+           </listitem>
+         </varlistentry>
+         
+
          <varlistentry>
            <term>max-cache-entries</term>
            <listitem>
index 543282f46f6b42d19e1a326ce97579ab6b9dfe08..802f2d80a57a04a2deebb7b4ad7668ec8657904f 100644 (file)
@@ -699,7 +699,6 @@ void handleRunningTCPQuestion(int fd, boost::any& var)
       dc->setSocket(tconn.fd);
       dc->d_tcp=true;
       dc->setRemote(&tconn.remote);
-
       if(dc->d_mdp.d_header.qr) {
        delete dc;
        L<<Logger::Error<<"Ignoring answer on server socket!"<<endl;
@@ -1437,7 +1436,16 @@ void parseAuthAndForwards()
 int serviceMain(int argc, char*argv[])
 {
   L.setName("pdns_recursor");
-  L.setLoglevel((Logger::Urgency)(4));
+
+  L.setLoglevel((Logger::Urgency)(6)); // info and up
+
+  if(!::arg()["logging-facility"].empty()) {
+    boost::optional<int> val=logFacilityToLOG(::arg().asNum("logging-facility") );
+    if(val)
+      theL().setFacility(*val);
+    else
+      L<<Logger::Error<<"Unknown logging facility "<<::arg().asNum("logging-facility") <<endl;
+  }
 
   L<<Logger::Warning<<"PowerDNS recursor "<<VERSION<<" (C) 2001-2006 PowerDNS.COM BV ("<<__DATE__", "__TIME__;
 #ifdef __GNUC__
@@ -1662,6 +1670,7 @@ int main(int argc, char **argv)
     ::arg().setSwitch( "logfile", "Filename of the log file" )= "recursor.log"; 
 #else
     ::arg().set("quiet","Suppress logging of questions and answers")="";
+    ::arg().set("logging-facility","Facility to log messages as. 0 corresponds to local0")="";
 #endif
     ::arg().set("config-dir","Location of configuration directory (recursor.conf)")=SYSCONFDIR;
     ::arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR;
@@ -1690,7 +1699,7 @@ int main(int argc, char **argv)
 
     ::arg().setCmd("help","Provide a helpful message");
     ::arg().setCmd("config","Output blank configuration");
-    L.toConsole(Logger::Warning);
+    L.toConsole(Logger::Info);
     ::arg().laxParse(argc,argv); // do a lax parse
 
     string configname=::arg()["config-dir"]+"/recursor.conf";