ipv6 counter in extended statistics.

git-svn-id: file:///svn/unbound/trunk@1397 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-12-17 14:50:03 +00:00
parent 340a6185d2
commit d714dfe8d8
8 changed files with 23 additions and 7 deletions

View file

@ -226,6 +226,7 @@ if test "$1" = "config" ; then
p_config "total.num.queries" "total queries from clients" p_config "total.num.queries" "total queries from clients"
p_config "total.num.cachehits" "cache hits" p_config "total.num.cachehits" "cache hits"
p_config "num.query.tcp" "TCP queries" p_config "num.query.tcp" "TCP queries"
p_config "num.query.ipv6" "IPv6 queries"
p_config "unwanted.queries" "queries that failed acl" p_config "unwanted.queries" "queries that failed acl"
p_config "unwanted.replies" "unwanted or unsolicited replies" p_config "unwanted.replies" "unwanted or unsolicited replies"
echo "u_replies.warning $warn" echo "u_replies.warning $warn"
@ -412,8 +413,8 @@ hits)
for x in thread0.num.queries thread1.num.queries thread2.num.queries \ for x in thread0.num.queries thread1.num.queries thread2.num.queries \
thread3.num.queries thread4.num.queries thread5.num.queries \ thread3.num.queries thread4.num.queries thread5.num.queries \
thread6.num.queries thread7.num.queries total.num.queries \ thread6.num.queries thread7.num.queries total.num.queries \
total.num.cachehits num.query.tcp unwanted.queries \ total.num.cachehits num.query.tcp num.query.ipv6 \
unwanted.replies; do unwanted.queries unwanted.replies; do
if grep "^"$x"=" $state >/dev/null 2>&1; then if grep "^"$x"=" $state >/dev/null 2>&1; then
print_qps $x print_qps $x
fi fi

View file

@ -773,6 +773,8 @@ print_ext(SSL* ssl, struct stats_info* s)
/* transport */ /* transport */
if(!ssl_printf(ssl, "num.query.tcp"SQ"%u\n", if(!ssl_printf(ssl, "num.query.tcp"SQ"%u\n",
(unsigned)s->svr.qtcp)) return 0; (unsigned)s->svr.qtcp)) return 0;
if(!ssl_printf(ssl, "num.query.ipv6"SQ"%u\n",
(unsigned)s->svr.qipv6)) return 0;
/* flags */ /* flags */
if(!ssl_printf(ssl, "num.query.flags.QR"SQ"%u\n", if(!ssl_printf(ssl, "num.query.flags.QR"SQ"%u\n",
(unsigned)s->svr.qbit_QR)) return 0; (unsigned)s->svr.qbit_QR)) return 0;

View file

@ -197,6 +197,7 @@ void server_stats_add(struct stats_info* total, struct stats_info* a)
total->svr.qtype_big += a->svr.qtype_big; total->svr.qtype_big += a->svr.qtype_big;
total->svr.qclass_big += a->svr.qclass_big; total->svr.qclass_big += a->svr.qclass_big;
total->svr.qtcp += a->svr.qtcp; total->svr.qtcp += a->svr.qtcp;
total->svr.qipv6 += a->svr.qipv6;
total->svr.qbit_QR += a->svr.qbit_QR; total->svr.qbit_QR += a->svr.qbit_QR;
total->svr.qbit_AA += a->svr.qbit_AA; total->svr.qbit_AA += a->svr.qbit_AA;
total->svr.qbit_TC += a->svr.qbit_TC; total->svr.qbit_TC += a->svr.qbit_TC;
@ -238,7 +239,8 @@ void server_stats_add(struct stats_info* total, struct stats_info* a)
} }
void server_stats_insquery(struct server_stats* stats, struct comm_point* c, void server_stats_insquery(struct server_stats* stats, struct comm_point* c,
uint16_t qtype, uint16_t qclass, struct edns_data* edns) uint16_t qtype, uint16_t qclass, struct edns_data* edns,
struct comm_reply* repinfo)
{ {
uint16_t flags = ldns_buffer_read_u16_at(c->buffer, 2); uint16_t flags = ldns_buffer_read_u16_at(c->buffer, 2);
if(qtype < STATS_QTYPE_NUM) if(qtype < STATS_QTYPE_NUM)
@ -250,6 +252,8 @@ void server_stats_insquery(struct server_stats* stats, struct comm_point* c,
stats->qopcode[ LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) ]++; stats->qopcode[ LDNS_OPCODE_WIRE(ldns_buffer_begin(c->buffer)) ]++;
if(c->type != comm_udp) if(c->type != comm_udp)
stats->qtcp++; stats->qtcp++;
if(repinfo && addr_is_ip6(&repinfo->addr, repinfo->addrlen))
stats->qipv6++;
if( (flags&BIT_QR) ) if( (flags&BIT_QR) )
stats->qbit_QR++; stats->qbit_QR++;
if( (flags&BIT_AA) ) if( (flags&BIT_AA) )

View file

@ -46,6 +46,7 @@
struct worker; struct worker;
struct config_file; struct config_file;
struct comm_point; struct comm_point;
struct comm_reply;
struct edns_data; struct edns_data;
/** number of qtype that is stored for in array */ /** number of qtype that is stored for in array */
@ -87,6 +88,8 @@ struct server_stats {
size_t qopcode[STATS_OPCODE_NUM]; size_t qopcode[STATS_OPCODE_NUM];
/** number of queries over TCP */ /** number of queries over TCP */
size_t qtcp; size_t qtcp;
/** number of queries over IPv6 */
size_t qipv6;
/** number of queries with QR bit */ /** number of queries with QR bit */
size_t qbit_QR; size_t qbit_QR;
/** number of queries with AA bit */ /** number of queries with AA bit */
@ -113,7 +116,7 @@ struct server_stats {
size_t ans_rcode_nodata; size_t ans_rcode_nodata;
/** answers that were secure (AD) */ /** answers that were secure (AD) */
size_t ans_secure; size_t ans_secure;
/** answers with bogus content */ /** answers that were bogus (withheld as SERVFAIL) */
size_t ans_bogus; size_t ans_bogus;
/** rrsets marked bogus by validator */ /** rrsets marked bogus by validator */
size_t rrset_bogus; size_t rrset_bogus;
@ -204,9 +207,11 @@ void server_stats_add(struct stats_info* total, struct stats_info* a);
* @param qtype: query type * @param qtype: query type
* @param qclass: query class * @param qclass: query class
* @param edns: edns record * @param edns: edns record
* @param repinfo: reply info with remote address
*/ */
void server_stats_insquery(struct server_stats* stats, struct comm_point* c, void server_stats_insquery(struct server_stats* stats, struct comm_point* c,
uint16_t qtype, uint16_t qclass, struct edns_data* edns); uint16_t qtype, uint16_t qclass, struct edns_data* edns,
struct comm_reply* repinfo);
/** /**
* Add rcode for this query. * Add rcode for this query.

View file

@ -816,7 +816,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
} }
if(worker->stats.extended) if(worker->stats.extended)
server_stats_insquery(&worker->stats, c, qinfo.qtype, server_stats_insquery(&worker->stats, c, qinfo.qtype,
qinfo.qclass, &edns); qinfo.qclass, &edns, repinfo);
if(c->type != comm_udp) if(c->type != comm_udp)
edns.udp_size = 65535; /* max size for TCP replies */ edns.udp_size = 65535; /* max size for TCP replies */
if(qinfo.qclass == LDNS_RR_CLASS_CH && answer_chaos(worker, &qinfo, if(qinfo.qclass == LDNS_RR_CLASS_CH && answer_chaos(worker, &qinfo,

View file

@ -1,6 +1,8 @@
17 December 2008: Wouter 17 December 2008: Wouter
- follows ldns makedist.sh. -rc option. autom4te dir removed. - follows ldns makedist.sh. -rc option. autom4te dir removed.
- unbound-control status command. - unbound-control status command.
- extended statistics has a number of ipv6 queries counter.
contrib/unbound_munin_ was updated to draw ipv6 in the hits graph.
16 December 2008: Wouter 16 December 2008: Wouter
- follow makedist improvements from ldns, for maintainers prereleases. - follow makedist improvements from ldns, for maintainers prereleases.

View file

@ -58,5 +58,4 @@ o local-zone directive with authority service, full authority server
is a non-goal. is a non-goal.
o configure option to force use of builtin ldns tarball. o configure option to force use of builtin ldns tarball.
o include /etc/pki/dnssec-keys/production/*.conf with wildcard support. o include /etc/pki/dnssec-keys/production/*.conf with wildcard support.
o add extended stat counter for num queries over ipv6, ipv6 usage.
o make so revoke bit keys cannot verify signatures o make so revoke bit keys cannot verify signatures

View file

@ -259,6 +259,9 @@ Also printed for other opcodes, UPDATE, ...
.I num.query.tcp .I num.query.tcp
Number of queries that were made using TCP towards the unbound server. Number of queries that were made using TCP towards the unbound server.
.TP .TP
.I num.query.ipv6
Number of queries that were made using IPv6 towards the unbound server.
.TP
.I num.query.flags.RD .I num.query.flags.RD
The number of queries that had the RD flag set in the header. The number of queries that had the RD flag set in the header.
Also printed for flags QR, AA, TC, RA, Z, AD, CD. Also printed for flags QR, AA, TC, RA, Z, AD, CD.