From: Wouter Wijngaards Date: Fri, 6 Feb 2009 10:37:20 +0000 (+0000) Subject: log querier on verbosity 5 or higher. X-Git-Tag: release-1.3.0~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb436db87a71c578d4ce611397625e0a376b5e26;p=thirdparty%2Funbound.git log querier on verbosity 5 or higher. git-svn-id: file:///svn/unbound/trunk@1461 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/worker.c b/daemon/worker.c index 7635a858b..72ae3322a 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -747,6 +747,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, } if((ret=worker_check_request(c->buffer, worker)) != 0) { verbose(VERB_ALGO, "worker check request: bad query."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); if(ret != -1) { LDNS_QR_SET(ldns_buffer_begin(c->buffer)); LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret); @@ -759,6 +760,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, /* see if query is in the cache */ if(!query_info_parse(&qinfo, c->buffer)) { verbose(VERB_ALGO, "worker parse request: formerror."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); ldns_buffer_rewind(c->buffer); LDNS_QR_SET(ldns_buffer_begin(c->buffer)); LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), @@ -769,6 +771,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, if(qinfo.qtype == LDNS_RR_TYPE_AXFR || qinfo.qtype == LDNS_RR_TYPE_IXFR) { verbose(VERB_ALGO, "worker request: refused zone transfer."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); LDNS_QR_SET(ldns_buffer_begin(c->buffer)); LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), LDNS_RCODE_REFUSED); @@ -780,6 +783,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, } if((ret=parse_edns_from_pkt(c->buffer, &edns)) != 0) { verbose(VERB_ALGO, "worker parse edns: formerror."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); ldns_buffer_rewind(c->buffer); LDNS_QR_SET(ldns_buffer_begin(c->buffer)); LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), ret); @@ -792,6 +796,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, edns.udp_size = EDNS_ADVERTISED_SIZE; edns.bits &= EDNS_DO; verbose(VERB_ALGO, "query with bad edns version."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); error_encode(c->buffer, EDNS_RCODE_BADVERS&0xf, &qinfo, *(uint16_t*)ldns_buffer_begin(c->buffer), ldns_buffer_read_u16_at(c->buffer, 2), NULL); @@ -802,10 +807,12 @@ worker_handle_request(struct comm_point* c, void* arg, int error, worker->daemon->cfg->harden_short_bufsize) { verbose(VERB_QUERY, "worker request: EDNS bufsize %d ignored", (int)edns.udp_size); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); edns.udp_size = NORMAL_UDP_SIZE; } if(edns.edns_present && edns.udp_size < LDNS_HEADER_SIZE) { verbose(VERB_ALGO, "worker request: edns is too small."); + log_addr(VERB_CLIENT, "from", &repinfo->addr, repinfo->addrlen); LDNS_QR_SET(ldns_buffer_begin(c->buffer)); LDNS_TC_SET(ldns_buffer_begin(c->buffer)); LDNS_RCODE_SET(ldns_buffer_begin(c->buffer), @@ -876,6 +883,14 @@ worker_handle_request(struct comm_point* c, void* arg, int error, ldns_buffer_rewind(c->buffer); server_stats_querymiss(&worker->stats, worker); + if(verbosity >= VERB_CLIENT) { + if(c->type == comm_udp) + log_addr(VERB_CLIENT, "udp request from", + &repinfo->addr, repinfo->addrlen); + else log_addr(VERB_CLIENT, "tcp request from", + &repinfo->addr, repinfo->addrlen); + } + /* grab a work request structure for this new request */ if(worker->env.mesh->num_reply_addrs>worker->request_size*16) { /* protect our memory usage from storing reply addresses */ diff --git a/doc/Changelog b/doc/Changelog index 1c7deee71..e8e0b2567 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -6,6 +6,7 @@ - config parser changed. Gives some syntax errors closer to where they occurred. Does not enforce a space after keyword anymore. Does not allow literal newlines inside quoted strings anymore. + - verbosity level 5 logs customer IP for new requestlist entries. 5 February 2009: Wouter - ldns 1.5.0 rc as tarball included. diff --git a/doc/TODO b/doc/TODO index 9484292cb..0d4efc164 100644 --- a/doc/TODO +++ b/doc/TODO @@ -59,7 +59,6 @@ o local-zone directive with authority service, full authority server o make so revoke bit keys cannot verify signatures o option to print UTC timestamps instead of epoch in seconds. -o print querier IP address on high loglevels. o infra and lame cache: easier size config (in Mb), show usage in graphs. o #226: unbound_control dump_requestlist @@ -70,5 +69,4 @@ o #231: unbound_checkconf options to output config file data. o config entry to denote that a zone is to be treated as unsigned (even if a DS exists to higher trust anchor). o see if we can include the python bindings (contrib). -o see if we can suport var:value (nospace) by parser. o remote control read ssl information while priviledged. diff --git a/doc/unbound.conf.5.in b/doc/unbound.conf.5.in index 036f97994..3d9897aa9 100644 --- a/doc/unbound.conf.5.in +++ b/doc/unbound.conf.5.in @@ -86,10 +86,9 @@ clause. The verbosity number, level 0 means no verbosity, only errors. Level 1 gives operational information. Level 2 gives detailed operational information. Level 3 gives query level information, output per query. -Level 4 gives algorithm level information. -Default is level 1. The verbosity can also be increased from the commandline, -see -\fIunbound\fR(8). +Level 4 gives algorithm level information. Level 5 logs client +identification for cache misses. Default is level 1. +The verbosity can also be increased from the commandline, see \fIunbound\fR(8). .TP .B statistics\-interval: \fI The number of seconds between printing statistics to the log for every thread. diff --git a/util/log.h b/util/log.h index 39a15310a..c61a61268 100644 --- a/util/log.h +++ b/util/log.h @@ -60,7 +60,9 @@ enum verbosity_value { /** 3 - query level information */ VERB_QUERY, /** 4 - algorithm level information */ - VERB_ALGO + VERB_ALGO, + /** 5 - querier client information */ + VERB_CLIENT }; /** The global verbosity setting */