]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
log querier on verbosity 5 or higher.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 6 Feb 2009 10:37:20 +0000 (10:37 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 6 Feb 2009 10:37:20 +0000 (10:37 +0000)
git-svn-id: file:///svn/unbound/trunk@1461 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/worker.c
doc/Changelog
doc/TODO
doc/unbound.conf.5.in
util/log.h

index 7635a858b5e3c085a11f3f0d9047e651484c4ee8..72ae3322af55e21d1338996c017af257b0c0f7ec 100644 (file)
@@ -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 */
index 1c7deee71f2d3800e82c74dfee3f640fb8d8e2ac..e8e0b25675c5d6008a14b11a768c08d2ddeac21d 100644 (file)
@@ -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.
index 9484292cb4f0ada56d4507f6dfb2082652f3e81d..0d4efc16442883cb244ea5992486d47c8610d374 100644 (file)
--- 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.
index 036f979943b19322fbf886caed878defe7324a47..3d9897aa9371ad3ec20fa4fcd98cafc5283d32af 100644 (file)
@@ -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<seconds>
 The number of seconds between printing statistics to the log for every thread.
index 39a15310a12cb4b6ae27b26365a40c221deea417..c61a612688adc4cefd35942fa4f55a221a1d7762 100644 (file)
@@ -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 */