]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Redo:
authorMark Andrews <marka@isc.org>
Mon, 28 May 2001 05:17:05 +0000 (05:17 +0000)
committerMark Andrews <marka@isc.org>
Mon, 28 May 2001 05:17:05 +0000 (05:17 +0000)
 839.   [func]          Dump packets for which there was no view or that the
                        class could not be determined to category "unmatched".

CHANGES
bin/named/client.c
bin/named/include/named/globals.h
bin/named/include/named/log.h
bin/named/log.c
bin/named/logconf.c
bin/named/main.c
bin/named/server.c
doc/arm/Bv9ARM-book.xml

diff --git a/CHANGES b/CHANGES
index 258a3c87a04e677d787ac062e20dec06d8ddc6df..7b564627e1b175ec403f927c7865ec49deaf779d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,5 @@
  839.  [func]          Dump packets for which there was no view or that the
-                       class could not be determined to file, (-e filename).
+                       class could not be determined to category "unmatched".
 
  838.  [port]          UnixWare 7.x.x is now suported by
                        bin/tests/system/ifconfig.sh.
index f4211c6fedd6ad713a153886d59df79683b2fabf..46b2f4fe9c6f936102a17f3313c0d08f775ee6bb 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: client.c,v 1.168 2001/05/25 07:39:45 marka Exp $ */
+/* $Id: client.c,v 1.169 2001/05/28 05:16:54 marka Exp $ */
 
 #include <config.h>
 
@@ -2258,34 +2258,17 @@ ns_client_aclmsg(const char *msg, dns_name_t *name, dns_rdataclass_t rdclass,
         (void)snprintf(buf, len, "%s '%s/%s'", msg, namebuf, classbuf);
 }
 
-static isc_mutex_t dumpmessagemutex;
-
-static void dumpmessagemutex_init(void) {
-       (void)isc_mutex_init(&dumpmessagemutex);
-}
-
 static void
 ns_client_dumpmessage(ns_client_t *client, const char *reason) {
-       static isc_once_t once = ISC_ONCE_INIT;
-       char peerbuf[ISC_SOCKADDR_FORMATSIZE];
        isc_buffer_t buffer;
        char *buf = NULL;
        int len = 1024;
        isc_result_t result;
-       FILE *fd = NULL;
-
-       if (ns_g_examinelog == NULL)
-               return;
 
-       ns_client_name(client, peerbuf, sizeof(peerbuf));
-
-       isc_once_do(&once, dumpmessagemutex_init);
-
-       LOCK(&dumpmessagemutex);
-
-       result = isc_stdio_open(ns_g_examinelog, "a", &fd);
-       if (result != ISC_R_SUCCESS)
-               goto unlock;
+       /*
+        * Note these a multiline debug messages.  We want a newline
+        * to appear in the log after each message.
+        */
 
        do {
                buf = isc_mem_get(client->mctx, len);
@@ -2299,13 +2282,13 @@ ns_client_dumpmessage(ns_client_t *client, const char *reason) {
                        isc_mem_put(client->mctx, buf, len);
                        len += 1024;
                } else if (result == ISC_R_SUCCESS)
-                       fprintf(fd, "\nclient %s: %s\n%.*s\n", peerbuf, reason,
-                               (int)isc_buffer_usedlength(&buffer), buf);
+                       ns_client_log(client, NS_LOGCATEGORY_UNMATCHED,
+                                     NS_LOGMODULE_CLIENT, ISC_LOG_INFO,
+                                     "%s\n%.*s", reason,
+                                      (int)isc_buffer_usedlength(&buffer),
+                                      buf);
        } while (result == ISC_R_NOSPACE);
 
        if (buf != NULL)
                isc_mem_put(client->mctx, buf, len);
-       (void)isc_stdio_close(fd);
- unlock:
-       UNLOCK(&dumpmessagemutex);
 }
index 0c40680f501c00425f7d20ef31e671bd978f024d..dcc7e9d29b55ff3a86e7e7f47c9398bcc490ca14 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: globals.h,v 1.55 2001/05/25 07:39:48 marka Exp $ */
+/* $Id: globals.h,v 1.56 2001/05/28 05:17:01 marka Exp $ */
 
 #ifndef NAMED_GLOBALS_H
 #define NAMED_GLOBALS_H 1
@@ -104,7 +104,6 @@ EXTERN const char *         ns_g_defaultpidfile     INIT(NS_LOCALSTATEDIR
 EXTERN const char *            lwresd_g_defaultpidfile INIT(NS_LOCALSTATEDIR
                                                             "/run/lwresd.pid");
 EXTERN const char *            ns_g_username           INIT(NULL);
-EXTERN const char *            ns_g_examinelog         INIT(NULL);
 
 #undef EXTERN
 #undef INIT
index 2a867f590d018e0572be1dca1a6ae025b9d63563..8166a25f07bef587a70c9ba10f86c7f2fc5d1e01 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: log.h,v 1.18 2001/03/27 00:44:38 bwelling Exp $ */
+/* $Id: log.h,v 1.19 2001/05/28 05:17:02 marka Exp $ */
 
 #ifndef NAMED_LOG_H
 #define NAMED_LOG_H 1
@@ -32,6 +32,7 @@
 #define NS_LOGCATEGORY_NETWORK         (&ns_g_categories[2])
 #define NS_LOGCATEGORY_UPDATE          (&ns_g_categories[3])
 #define NS_LOGCATEGORY_QUERIES         (&ns_g_categories[4])
+#define NS_LOGCATEGORY_UNMATCHED       (&ns_g_categories[5])
 
 /*
  * Backwards compatibility.
@@ -82,6 +83,12 @@ ns_log_setdefaultcategory(isc_logconfig_t *lcfg);
  * Set up "category default" to go to the right places.
  */
 
+isc_result_t
+ns_log_setunmatchedcategory(isc_logconfig_t *lcfg);
+/*
+ * Set up "category unmatched" to go to the right places.
+ */
+
 void
 ns_log_shutdown(void);
 
index 8a0344a3be506170923e3d2b0d035b94ed1865c2..e1fbcd6407e17bd88e67ecf775f8e75135fa7ec3 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: log.c,v 1.31 2001/03/27 00:44:31 bwelling Exp $ */
+/* $Id: log.c,v 1.32 2001/05/28 05:16:55 marka Exp $ */
 
 #include <config.h>
 
@@ -35,6 +35,7 @@ static isc_logcategory_t categories[] = {
        { "network",                    0 },
        { "update",                     0 },
        { "queries",                    0 },
+       { "unmatched",                  0 },
        { NULL,                         0 }
 };
 
@@ -181,6 +182,15 @@ ns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
        return (result);
 }
 
+isc_result_t
+ns_log_setunmatchedcategory(isc_logconfig_t *lcfg) {
+       isc_result_t result;
+
+       result = isc_log_usechannel(lcfg, "null",
+                                   NS_LOGCATEGORY_UNMATCHED, NULL);
+       return (result);
+}
+
 void
 ns_log_shutdown(void) {
        isc_log_destroy(&ns_g_lctx);
index 0198dea8a9130ef005bb23d03b2078e498f880d0..4fab9dda78abb25af1de932d5b5ff8a45b216295 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: logconf.c,v 1.29 2001/04/26 02:38:08 tale Exp $ */
+/* $Id: logconf.c,v 1.30 2001/05/28 05:16:57 marka Exp $ */
 
 #include <config.h>
 
@@ -245,6 +245,7 @@ ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) {
        cfg_obj_t *categories = NULL;
        cfg_listelt_t *element;
        isc_boolean_t default_set = ISC_FALSE;
+       isc_boolean_t unmatched_set = ISC_FALSE;
 
        CHECK(ns_log_setdefaultchannels(logconf));
 
@@ -269,11 +270,19 @@ ns_log_configure(isc_logconfig_t *logconf, cfg_obj_t *logstmt) {
                        if (strcmp(cfg_obj_asstring(catname), "default"))
                                default_set = ISC_TRUE;
                }
+               if (!unmatched_set) {
+                       cfg_obj_t *catname = cfg_tuple_get(category, "name");
+                       if (strcmp(cfg_obj_asstring(catname), "unmatched"))
+                               unmatched_set = ISC_TRUE;
+               }
        }
 
        if (!default_set)
                CHECK(ns_log_setdefaultcategory(logconf));
 
+       if (!unmatched_set)
+               CHECK(ns_log_setunmatchedcategory(logconf));
+
        return (ISC_R_SUCCESS);
 
  cleanup:
index fc2698a1fb4e6153478b37bda5dc6c0360bbbd7a..9a0d3d42b9604232b2f90236b3819f3fc60d1b0b 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: main.c,v 1.110 2001/05/25 07:39:46 marka Exp $ */
+/* $Id: main.c,v 1.111 2001/05/28 05:16:58 marka Exp $ */
 
 #include <config.h>
 
@@ -270,7 +270,7 @@ parse_command_line(int argc, char *argv[]) {
 
        isc_commandline_errprint = ISC_FALSE;
        while ((ch = isc_commandline_parse(argc, argv,
-                                          "c:C:d:e:fgi:ln:N:p:P:st:u:vx:")) !=
+                                          "c:C:d:fgi:ln:N:p:P:st:u:vx:")) !=
               -1) {
                switch (ch) {
                case 'c':
@@ -290,9 +290,6 @@ parse_command_line(int argc, char *argv[]) {
                        ns_g_debuglevel = parse_int(isc_commandline_argument,
                                                    "debug level");
                        break;
-               case 'e':
-                       ns_g_examinelog = isc_commandline_argument;
-                       break;
                case 'f':
                        ns_g_foreground = ISC_TRUE;
                        break;
index c52fcf328205e37e4b7fc775c2510b5405422b55..853de64cf16b0f0a855b0946969de8ba548d723f 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.326 2001/05/14 20:44:10 bwelling Exp $ */
+/* $Id: server.c,v 1.327 2001/05/28 05:17:00 marka Exp $ */
 
 #include <config.h>
 
@@ -1929,6 +1929,8 @@ load_configuration(const char *filename, ns_server_t *server,
                } else {
                        CHECKM(ns_log_setdefaultchannels(logc),
                               "setting up default logging channels");
+                       CHECKM(ns_log_setunmatchedcategory(logc),
+                              "setting up default 'category unmatched'");
                        CHECKM(ns_log_setdefaultcategory(logc),
                               "setting up default 'category default'");
                }
index 9da73c5ea0aec2f6060725657e7afcd17aee9c74..bde6477f4e2edad07e7b2b3fc3008a94ec85ed84 100644 (file)
@@ -2,7 +2,7 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
                "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.135 2001/05/19 00:07:33 gson Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.136 2001/05/28 05:17:05 marka Exp $ -->
 
 <book>
 <title>BIND 9 Administrator Reference Manual</title>
@@ -2271,6 +2271,7 @@ as many channels and categories as are wanted. If there is no <command>logging</
 the logging configuration will be:</para>
 
 <programlisting>logging {
+     category "unmatched" { "null"; };
      category "default" { "default_syslog"; "default_debug"; };
 };
 </programlisting>
@@ -2537,6 +2538,14 @@ lookups performed on behalf of clients by a caching name server.</para></entry>
 <entry colname = "2"><para>Processing of client requests.</para></entry>
 </row>
 <row rowsep = "0">
+<entry colname = "1"><para><command>unmatched</command></para></entry>
+<entry colname = "2"><para>Messages that named was unable to determine the
+class of or for which there was no matching <command>view</command>.
+A one line summary is also logged to the <command>client</command> category.
+This category is best sent to a file or stderr, by default it is sent to
+the <command>null</command> channel.</para></entry>
+</row>
+<row rowsep = "0">
 <entry colname = "1"><para><command>network</command></para></entry>
 <entry colname = "2"><para>Network operations.</para></entry>
 </row>