839.   [func]          Dump packets for which there was no view or that the
                        class could not be determined to category "unmatched".
This commit is contained in:
Mark Andrews
2001-05-28 05:17:05 +00:00
parent 1666a83cab
commit 89d03d4715
9 changed files with 56 additions and 40 deletions

View File

@@ -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.

View 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);
}

View 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

View 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);

View 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);

View 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:

View 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;

View 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'");
}

View 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>