Browse Source

[trac1039] Modifications after review

Stephen Morris 14 years ago
parent
commit
6f7998f9a2
2 changed files with 46 additions and 33 deletions
  1. 23 16
      src/bin/resolver/resolver.cc
  2. 23 17
      src/bin/resolver/resolver_messages.mes

+ 23 - 16
src/bin/resolver/resolver.cc

@@ -83,7 +83,7 @@ public:
                     isc::cache::ResolverCache& cache)
     {
         assert(!rec_query_); // queryShutdown must be called first
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_RECQ_SETUP);
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_QUERY_SETUP);
         rec_query_ = new RecursiveQuery(dnss, 
                                         nsas, cache,
                                         upstream_,
@@ -99,7 +99,8 @@ public:
         // (this is not a safety check, just to prevent logging of
         // actions that are not performed
         if (rec_query_) {
-            LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_RECQ_SHUTDOWN);
+            LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT,
+                      RESOLVER_QUERY_SHUTDOWN);
             delete rec_query_;
             rec_query_ = NULL;
         }
@@ -112,7 +113,7 @@ public:
         if (dnss) {
             if (!upstream_.empty()) {
                 BOOST_FOREACH(const AddressPair& address, upstream) {
-                    LOG_INFO(resolver_logger, RESOLVER_FWD_ADDRESS)
+                    LOG_INFO(resolver_logger, RESOLVER_FORWARD_ADDRESS)
                              .arg(address.first).arg(address.second);
                 }
             } else {
@@ -302,7 +303,8 @@ public:
 
         answer_message->toWire(renderer);
 
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_DETAIL, RESOLVER_DNS_MSG_SENT)
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_DETAIL,
+                  RESOLVER_DNS_MESSAGE_SENT)
                   .arg(renderer.getLength()).arg(*answer_message);
     }
 };
@@ -418,7 +420,7 @@ Resolver::processMessage(const IOMessage& io_message,
         server->resume(true);
         return;
     } catch (const Exception& ex) {
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_IO, RESOLVER_PROTOCOL_ERROR)
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_IO, RESOLVER_MESSAGE_ERROR)
                   .arg(ex.what()).arg(Rcode::SERVFAIL());
         makeErrorMessage(query_message, answer_message,
                          buffer, Rcode::SERVFAIL());
@@ -429,8 +431,8 @@ Resolver::processMessage(const IOMessage& io_message,
     // Note:  there appears to be no LOG_DEBUG for a successfully-received
     // message.  This is not an oversight - it is handled below.  In the
     // meantime, output the full message for debug purposes (if requested).
-    LOG_DEBUG(resolver_logger, RESOLVER_DBG_DETAIL, RESOLVER_DNS_MSG_RECVD)
-              .arg(*query_message);
+    LOG_DEBUG(resolver_logger, RESOLVER_DBG_DETAIL,
+              RESOLVER_DNS_MESSAGE_RECEIVED).arg(*query_message);
 
     // Perform further protocol-level validation.
     bool sendAnswer = true;
@@ -439,20 +441,22 @@ Resolver::processMessage(const IOMessage& io_message,
         makeErrorMessage(query_message, answer_message,
                          buffer, Rcode::NOTAUTH());
         // Notify arrived, but we are not authoritative.
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS, RESOLVER_NOTIFY_RECVD);
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS,
+                  RESOLVER_NOTIFY_RECEIVED);
 
     } else if (query_message->getOpcode() != Opcode::QUERY()) {
 
         // Unsupported opcode.
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS, RESOLVER_UNSUPPORTED_OPCODE)
-                  .arg(query_message->getOpcode());
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS,
+                  RESOLVER_UNSUPPORTED_OPCODE).arg(query_message->getOpcode());
         makeErrorMessage(query_message, answer_message,
                          buffer, Rcode::NOTIMP());
 
     } else if (query_message->getRRCount(Message::SECTION_QUESTION) != 1) {
 
         // Not one question
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS, RESOLVER_NOT_ONE_QUEST)
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_PROCESS,
+                  RESOLVER_NOT_ONE_QUESTION)
                   .arg(query_message->getRRCount(Message::SECTION_QUESTION));
         makeErrorMessage(query_message, answer_message,
                          buffer, Rcode::FORMERR());
@@ -525,7 +529,7 @@ ResolverImpl::processNormalQuery(ConstMessagePtr query_message,
     } else {
 
         // Processing forward query
-        LOG_DEBUG(resolver_logger, RESOLVER_DBG_IO, RESOLVER_FWD_QUERY);
+        LOG_DEBUG(resolver_logger, RESOLVER_DBG_IO, RESOLVER_FORWARD_QUERY);
         rec_query_->forward(query_message, answer_message, buffer, server);
     }
 }
@@ -560,7 +564,8 @@ Resolver::updateConfig(ConstElementPtr config) {
             // check for us
             qtimeout = qtimeoutE->intValue();
             if (qtimeout < -1) {
-                LOG_ERROR(resolver_logger, RESOLVER_QUERY_TMO_SMALL).arg(qtimeout);
+                LOG_ERROR(resolver_logger, RESOLVER_QUERY_TIME_SMALL)
+                          .arg(qtimeout);
                 isc_throw(BadValue, "Query timeout too small");
             }
             set_timeouts = true;
@@ -568,7 +573,8 @@ Resolver::updateConfig(ConstElementPtr config) {
         if (ctimeoutE) {
             ctimeout = ctimeoutE->intValue();
             if (ctimeout < -1) {
-                LOG_ERROR(resolver_logger, RESOLVER_CLI_TMO_SMALL).arg(ctimeout);
+                LOG_ERROR(resolver_logger, RESOLVER_CLIENT_TIME_SMALL)
+                          .arg(ctimeout);
                 isc_throw(BadValue, "Client timeout too small");
             }
             set_timeouts = true;
@@ -576,7 +582,8 @@ Resolver::updateConfig(ConstElementPtr config) {
         if (ltimeoutE) {
             ltimeout = ltimeoutE->intValue();
             if (ltimeout < -1) {
-                LOG_ERROR(resolver_logger, RESOLVER_LKUP_TMO_SMALL).arg(ltimeout);
+                LOG_ERROR(resolver_logger, RESOLVER_LOOKUP_TIME_SMALL)
+                          .arg(ltimeout);
                 isc_throw(BadValue, "Lookup timeout too small");
             }
             set_timeouts = true;
@@ -586,7 +593,7 @@ Resolver::updateConfig(ConstElementPtr config) {
             // _after_ the comparison (as opposed to before it for the timeouts)
             // because "retries" is unsigned.
             if (retriesE->intValue() < 0) {
-                LOG_ERROR(resolver_logger, RESOLVER_NEG_RETRIES)
+                LOG_ERROR(resolver_logger, RESOLVER_NEGATIVE_RETRIES)
                           .arg(retriesE->intValue());
                 isc_throw(BadValue, "Negative number of retries");
             }

+ 23 - 17
src/bin/resolver/resolver_messages.mes

@@ -25,7 +25,7 @@ A debug message, the resolver received a NOTIFY message over UDP.  The server
 cannot process it (and in any case, an AXFR request should be sent over TCP)
 and will return an error message to the sender with the RCODE set to FORMERR.
 
-% RESOLVER_CLI_TMO_SMALL client timeout of %1 is too small
+% RESOLVER_CLIENT_TIME_SMALL client timeout of %1 is too small
 An error indicating that the configuration value specified for the query
 timeout is too small.
 
@@ -51,11 +51,11 @@ information.
 % RESOLVER_CREATED main resolver object created
 A debug message, output when the Resolver() object has been created.
 
-% RESOLVER_DNS_MSG_RECVD DNS message received: %1
+% RESOLVER_DNS_MESSAGE_RECEIVED DNS message received: %1
 A debug message, this always precedes some other logging message and is the
 formatted contents of the DNS packet that the other message refers to.
 
-% RESOLVER_DNS_MSG_SENT DNS message of %1 bytes sent: %2
+% RESOLVER_DNS_MESSAGE_SENT DNS message of %1 bytes sent: %2
 A debug message, this contains details of the response sent back to the querying
 system.
 
@@ -63,11 +63,11 @@ system.
 This is an error message output when an unhandled exception is caught by the
 resolver.  All it can do is to shut down.
 
-% RESOLVER_FWD_ADDRESS setting forward address %1(%2)
+% RESOLVER_FORWARD_ADDRESS setting forward address %1(%2)
 This message may appear multiple times during startup, and it lists the
 forward addresses used by the resolver when running in forwarding mode.
 
-% RESOLVER_FWD_QUERY processing forward query
+% RESOLVER_FORWARD_QUERY processing forward query
 The received query has passed all checks and is being forwarded to upstream
 servers.
 
@@ -79,11 +79,17 @@ a received packet.  The packet has been dropped.
 The resolver received a NOTIFY message over TCP.  The server cannot process it
 and will return an error message to the sender with the RCODE set to NOTIMP.
 
-% RESOLVER_LKUP_TMO_SMALL lookup timeout of %1 is too small
+% RESOLVER_LOOKUP_TIME_SMALL lookup timeout of %1 is too small
 An error indicating that the configuration value specified for the lookup
 timeout is too small.
 
-% RESOLVER_NEG_RETRIES negative number of retries (%1) specified in the configuration
+% RESOLVER_MESSAGE_ERROR error parsing received message: %1 - returning %2
+A debug message noting that the resolver received a message and the
+parsing of the body of the message failed due to some error (although
+the parsing of the header succeeded).  The message parameters give a
+textual description of the problem and the RCODE returned.
+
+% RESOLVER_NEGATIVE_RETRIES negative number of retries (%1) specified in the configuration
 An error message indicating that the resolver configuration has specified a
 negative retry count.  Only zero or positive values are valid.
 
@@ -95,12 +101,12 @@ the sender.
 % RESOLVER_NORMAL_QUERY processing normal query
 The received query has passed all checks and is being processed by the resolver.
 
-% RESOLVER_NOTIFY_RECVD NOTIFY arrived but server is not authoritative
+% RESOLVER_NOTIFY_RECEIVED NOTIFY arrived but server is not authoritative
 The resolver received a NOTIFY message.  As the server is not authoritative it
 cannot process it, so it returns an error message to the sender with the RCODE
 set to NOTAUTH.
 
-% RESOLVER_NOT_ONE_QUEST query contained %1 questions, exactly one question was expected
+% RESOLVER_NOT_ONE_QUESTION query contained %1 questions, exactly one question was expected
 A debug message, the resolver received a query that contained the number of
 entires in the question section detailed in the message.  This is a malformed
 message, as a DNS query must contain only one question.  The resolver will
@@ -126,21 +132,21 @@ of the body of the message failed due to some protocol error (although the
 parsing of the header succeeded).  The message parameters give a textual
 description of the problem and the RCODE returned.
 
-% RESOLVER_QUERY_TMO_SMALL query timeout of %1 is too small
+% RESOLVER_QUERY_SETUP query setup
+A debug message noting that the resolver is creating a RecursiveQuery object.
+
+% RESOLVER_QUERY_SHUTDOWN query shutdown
+A debug message noting that the resolver is destroying a RecursiveQuery object.
+
+% RESOLVER_QUERY_TIME_SMALL query timeout of %1 is too small
 An error indicating that the configuration value specified for the query
 timeout is too small.
 
-% RESOLVER_RECEIVED_MSG resolver has received a DNS message
+% RESOLVER_RECEIVED_MESSAGE resolver has received a DNS message
 A debug message indicating that the resolver has received a message.  Depending
 on the debug settings, subsequent log output will indicate the nature of the
 message.
 
-% RESOLVER_RECQ_SETUP query setup
-A debug message noting that the resolver is creating a RecursiveQuery object.
-
-% RESOLVER_RECQ_SHUTDOWN query shutdown
-A debug message noting that the resolver is destroying a RecursiveQuery object.
-
 % RESOLVER_RECURSIVE running in recursive mode
 This is an informational message that appears at startup noting that the
 resolver is running in recursive mode.