]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix stats double count issue (#289).
authorRalph Dolmans <ralph@nlnetlabs.nl>
Thu, 20 Aug 2020 15:54:28 +0000 (17:54 +0200)
committerRalph Dolmans <ralph@nlnetlabs.nl>
Thu, 20 Aug 2020 15:54:28 +0000 (17:54 +0200)
daemon/worker.c
doc/Changelog

index 23e3244c504168632946b5badf56685a41beb857..680241fff0d897cc7b1eac005d7d7e8c62b16c11 100644 (file)
@@ -1219,7 +1219,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                LDNS_QR_SET(sldns_buffer_begin(c->buffer));
                LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), 
                        LDNS_RCODE_FORMERR);
-               server_stats_insrcode(&worker->stats, c->buffer);
                goto send_reply;
        }
        if(worker->env.cfg->log_queries) {
@@ -1237,7 +1236,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        LDNS_RCODE_REFUSED);
                if(worker->stats.extended) {
                        worker->stats.qtype[qinfo.qtype]++;
-                       server_stats_insrcode(&worker->stats, c->buffer);
                }
                goto send_reply;
        }
@@ -1259,7 +1257,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        LDNS_RCODE_FORMERR);
                if(worker->stats.extended) {
                        worker->stats.qtype[qinfo.qtype]++;
-                       server_stats_insrcode(&worker->stats, c->buffer);
                }
                goto send_reply;
        }
@@ -1275,7 +1272,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        *(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
                        sldns_buffer_read_u16_at(c->buffer, 2), &reply_edns);
                regional_free_all(worker->scratchpad);
-               server_stats_insrcode(&worker->stats, c->buffer);
                goto send_reply;
        }
        if(edns.edns_present) {
@@ -1354,7 +1350,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                edns.udp_size = 65535; /* max size for TCP replies */
        if(qinfo.qclass == LDNS_RR_CLASS_CH && answer_chaos(worker, &qinfo,
                &edns, repinfo, c->buffer)) {
-               server_stats_insrcode(&worker->stats, c->buffer);
                regional_free_all(worker->scratchpad);
                goto send_reply;
        }
@@ -1375,7 +1370,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        comm_point_drop_reply(repinfo);
                        return 0;
                }
-               server_stats_insrcode(&worker->stats, c->buffer);
                goto send_reply;
        }
        if(worker->env.auth_zones &&
@@ -1387,7 +1381,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        comm_point_drop_reply(repinfo);
                        return 0;
                }
-               server_stats_insrcode(&worker->stats, c->buffer);
                goto send_reply;
        }
        if(worker->env.auth_zones &&
@@ -1403,7 +1396,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                if(LDNS_RD_WIRE(sldns_buffer_begin(c->buffer)) &&
                   acl != acl_deny_non_local && acl != acl_refuse_non_local)
                        LDNS_RA_SET(sldns_buffer_begin(c->buffer));
-               server_stats_insrcode(&worker->stats, c->buffer);
                goto send_reply;
        }
 
@@ -1432,7 +1424,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
                        *(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
                        sldns_buffer_read_u16_at(c->buffer, 2), NULL);
                regional_free_all(worker->scratchpad);
-               server_stats_insrcode(&worker->stats, c->buffer);
                log_addr(VERB_ALGO, "refused nonrec (cache snoop) query from",
                        &repinfo->addr, repinfo->addrlen);
                goto send_reply;
@@ -1588,9 +1579,9 @@ send_reply_rc:
        if(is_expired_answer) {
                worker->stats.ans_expired++;
        }
+       server_stats_insrcode(&worker->stats, c->buffer);
        if(worker->stats.extended) {
                if(is_secure_answer) worker->stats.ans_secure++;
-               server_stats_insrcode(&worker->stats, repinfo->c->buffer);
        }
 #ifdef USE_DNSTAP
        if(worker->dtenv.log_client_response_messages)
index 8bc333e0d77878d9b5107e1b2deec1e1adf4c427..de643c8b1d6ee697a5d1d09b4aa9a38aa8c7a1ef 100644 (file)
@@ -1,3 +1,6 @@
+20 August 2020: Ralph
+       - Fix stats double count issue (#289).
+
 13 August 2020: Ralph
        - Create and init edns tags data for libunbound.