[patch] include client address in notify log messages
dean gaudet
dean-list-bind-workers at arctic.org
Fri Sep 17 08:57:06 UTC 2004
the notify log messages don't include the client address... it's useful
to know the address of a client sending notifies for a non-authoritative
zone, so that the configurations can be updated.
in this patch i decided to export ns_client_logv and use that in
notify_log to include the client address.
for example:
named[11872]: client 1.2.3.4#5: received notify for zone 'example.org': not authoritative
-dean
diff -ru bind9-9.2.3+9.2.4-rc7/bin/named/client.c bind9-9.2.3+9.2.4-rc7.dg1/bin/named/client.c
--- bind9-9.2.3+9.2.4-rc7/bin/named/client.c 2004-07-22 19:56:59.000000000 -0700
+++ bind9-9.2.3+9.2.4-rc7.dg1/bin/named/client.c 2004-09-17 01:26:42.000000000 -0700
@@ -2134,12 +2134,7 @@
snprintf(peerbuf, len, "@%p", client);
}
-static void
-ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
- isc_logmodule_t *module, int level, const char *fmt, va_list ap)
- ISC_FORMAT_PRINTF(5, 0);
-
-static void
+void
ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
isc_logmodule_t *module, int level, const char *fmt, va_list ap)
{
diff -ru bind9-9.2.3+9.2.4-rc7/bin/named/include/named/client.h bind9-9.2.3+9.2.4-rc7.dg1/bin/named/include/named/client.h
--- bind9-9.2.3+9.2.4-rc7/bin/named/include/named/client.h 2004-07-22 19:57:01.000000000 -0700
+++ bind9-9.2.3+9.2.4-rc7.dg1/bin/named/include/named/client.h 2004-09-17 01:26:29.000000000 -0700
@@ -305,6 +305,11 @@
const char *fmt, ...) ISC_FORMAT_PRINTF(5, 6);
void
+ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
+ isc_logmodule_t *module, int level, const char *fmt, va_list ap)
+ ISC_FORMAT_PRINTF(5, 0);
+
+void
ns_client_aclmsg(const char *msg, dns_name_t *name, dns_rdataclass_t rdclass,
char *buf, size_t len);
diff -ru bind9-9.2.3+9.2.4-rc7/bin/named/notify.c bind9-9.2.3+9.2.4-rc7.dg1/bin/named/notify.c
--- bind9-9.2.3+9.2.4-rc7/bin/named/notify.c 2004-03-08 22:09:19.000000000 -0800
+++ bind9-9.2.3+9.2.4-rc7.dg1/bin/named/notify.c 2004-09-17 01:27:54.000000000 -0700
@@ -36,11 +36,11 @@
*/
static void
-notify_log(int level, const char *fmt, ...) {
+notify_log(ns_client_t *client, int level, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
- isc_log_vwrite(ns_g_lctx, DNS_LOGCATEGORY_NOTIFY, NS_LOGMODULE_NOTIFY,
+ ns_client_logv(client, DNS_LOGCATEGORY_NOTIFY, NS_LOGMODULE_NOTIFY,
level, fmt, ap);
va_end(ap);
}
@@ -83,7 +83,7 @@
*/
result = dns_message_firstname(request, DNS_SECTION_QUESTION);
if (result != ISC_R_SUCCESS) {
- notify_log(ISC_LOG_INFO, "notify question section empty");
+ notify_log(client, ISC_LOG_INFO, "notify question section empty");
goto formerr;
}
@@ -94,7 +94,7 @@
dns_message_currentname(request, DNS_SECTION_QUESTION, &zonename);
zone_rdataset = ISC_LIST_HEAD(zonename->list);
if (ISC_LIST_NEXT(zone_rdataset, link) != NULL) {
- notify_log(ISC_LOG_INFO,
+ notify_log(client, ISC_LOG_INFO,
"notify question section contains multiple RRs");
goto formerr;
}
@@ -102,14 +102,14 @@
/* The zone section must have exactly one name. */
result = dns_message_nextname(request, DNS_SECTION_ZONE);
if (result != ISC_R_NOMORE) {
- notify_log(ISC_LOG_INFO,
+ notify_log(client, ISC_LOG_INFO,
"notify question section contains multiple RRs");
goto failure;
}
/* The one rdataset must be an SOA. */
if (zone_rdataset->type != dns_rdatatype_soa) {
- notify_log(ISC_LOG_INFO,
+ notify_log(client, ISC_LOG_INFO,
"notify question section contains no SOA");
goto formerr;
}
@@ -124,7 +124,7 @@
case dns_zone_master:
case dns_zone_slave:
case dns_zone_stub: /* Allow dialup passive to work. */
- notify_log(ISC_LOG_INFO, "received notify for zone '%s'", str);
+ notify_log(client, ISC_LOG_INFO, "received notify for zone '%s'", str);
respond(client, dns_zone_notifyreceive(zone,
ns_client_getsockaddr(client), request));
break;
@@ -135,7 +135,7 @@
return;
notauth:
- notify_log(ISC_LOG_INFO,
+ notify_log(client, ISC_LOG_INFO,
"received notify for zone '%s': not authoritative",
str);
result = DNS_R_NOTAUTH;
More information about the bind-workers
mailing list